本文整理汇总了C#中Db4objects.Db4o.Internal.Slots.Slot.Address方法的典型用法代码示例。如果您正苦于以下问题:C# Slot.Address方法的具体用法?C# Slot.Address怎么用?C# Slot.Address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Internal.Slots.Slot
的用法示例。
在下文中一共展示了Slot.Address方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DatabaseIdentityIDAndUUID
/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
private DatabaseIdentityIDAndUUID ReadDatabaseIdentityIDAndUUID
(ObjectContainerBase container, ClassMetadata classMetadata, Slot oldSlot, bool
checkClass)
{
if (DTrace.enabled)
{
DTrace.RereadOldUuid.LogLength(oldSlot.Address(), oldSlot.Length());
}
var reader = container.DecryptedBufferByAddress(oldSlot.Address(), oldSlot
.Length());
if (checkClass)
{
var realClass = ClassMetadata.ReadClass(container, reader);
if (realClass != classMetadata)
{
return null;
}
}
if (classMetadata.SeekToField(container.Transaction, reader, this) == HandlerVersion
.Invalid)
{
return null;
}
return new DatabaseIdentityIDAndUUID(reader.ReadInt(), reader.ReadLong
());
}
示例2: TestIndexMarshalling
public virtual void TestIndexMarshalling()
{
ByteArrayBuffer reader = new ByteArrayBuffer(2 * Const4.IntLength);
Slot original = new Slot(unchecked((int)(0xdb)), unchecked((int)(0x40)));
StringHandler().WriteIndexEntry(Context(), reader, original);
reader._offset = 0;
Slot retrieved = (Slot)StringHandler().ReadIndexEntry(Context(), reader);
Assert.AreEqual(original.Address(), retrieved.Address());
Assert.AreEqual(original.Length(), retrieved.Length());
}
示例3: WriteToFile
private void WriteToFile(Transaction trans, ByteArrayBuffer writer, Slot slot)
{
if (DTrace.enabled)
{
DTrace.PersistentbaseWrite.Log(GetID());
}
LocalObjectContainer container = (LocalObjectContainer)trans.Container();
WriteThis(trans, writer);
container.WriteEncrypt(writer, slot.Address(), 0);
if (IsActive())
{
SetStateClean();
}
}
示例4: Overlap
private bool Overlap(Slot slot, Slot other)
{
Slot first = slot.Address() < other.Address() ? slot : other;
Slot second = slot.Address() > other.Address() ? slot : other;
return first.Address() + first.Length() >= second.Address();
}
示例5: MapId
public override void MapId(int id, Slot slot)
{
_slotTree.Add(Trans(), new IdSlotMapping(id, slot.Address(), slot.Length()));
if (_commitFrequency > 0)
{
_slotInsertCount++;
if (_commitFrequency == _slotInsertCount)
{
_slotTree.Commit(Trans());
_slotInsertCount = 0;
}
}
}
示例6: Free
public override void Free(Slot slot)
{
if (!IsStarted())
{
return;
}
if (IsDelegating())
{
_delegate.Free(slot);
return;
}
try
{
BeginDelegation();
if (DTrace.enabled)
{
DTrace.FreespacemanagerBtreeFree.LogLength(slot.Address(), slot.Length());
}
Slot[] remove = new Slot[2];
Slot newFreeSlot = slot;
BTreePointer pointer = SearchBTree(_slotsByAddress, slot, SearchTarget.Lowest);
BTreePointer previousPointer = pointer != null ? pointer.Previous() : _slotsByAddress
.LastPointer(Transaction());
if (previousPointer != null)
{
Slot previousSlot = (Slot)previousPointer.Key();
if (previousSlot.IsDirectlyPreceding(newFreeSlot))
{
remove[0] = previousSlot;
newFreeSlot = previousSlot.Append(newFreeSlot);
}
}
if (pointer != null)
{
Slot nextSlot = (Slot)pointer.Key();
if (newFreeSlot.IsDirectlyPreceding(nextSlot))
{
remove[1] = nextSlot;
newFreeSlot = newFreeSlot.Append(nextSlot);
}
}
for (int i = 0; i < remove.Length; i++)
{
if (remove[i] != null)
{
RemoveSlot(remove[i]);
}
}
if (!CanDiscard(newFreeSlot.Length()))
{
AddSlot(newFreeSlot);
}
SlotFreed(slot);
}
finally
{
EndDelegation();
}
}
示例7: ZeroFile
private void ZeroFile(BlockAwareBin io, Slot slot)
{
if (io == null)
{
return;
}
byte[] zeroBytes = new byte[1024];
int left = slot.Length();
int offset = 0;
while (left > zeroBytes.Length)
{
io.BlockWrite(slot.Address(), offset, zeroBytes, zeroBytes.Length);
offset += zeroBytes.Length;
left -= zeroBytes.Length;
}
if (left > 0)
{
io.BlockWrite(slot.Address(), offset, zeroBytes, left);
}
}
示例8: Add
public virtual void Add(Slot slot)
{
_slots = ((TreeIntObject) Tree.Add(_slots, new TreeIntObject(slot.Address(), slot)
));
}
示例9: ReadStatefulBufferBySlot
public virtual StatefulBuffer ReadStatefulBufferBySlot(Transaction trans, int id,
Slot slot)
{
if (Slot.IsNull(slot))
{
return null;
}
if (DTrace.enabled)
{
DTrace.ReadSlot.LogLength(slot.Address(), slot.Length());
}
StatefulBuffer buffer = CreateStatefulBuffer(trans, slot.Address(), slot.Length()
);
buffer.SetID(id);
buffer.ReadEncrypt(this, slot.Address());
return buffer;
}
示例10: ReadBufferBySlot
public virtual ByteArrayBuffer ReadBufferBySlot(Slot slot)
{
if (Slot.IsNull(slot))
{
return null;
}
if (DTrace.enabled)
{
DTrace.ReadSlot.LogLength(slot.Address(), slot.Length());
}
ByteArrayBuffer buffer = new ByteArrayBuffer(slot.Length());
buffer.ReadEncrypt(this, slot.Address());
return buffer;
}
示例11: Free
public virtual void Free(Slot slot)
{
if (slot.IsNull())
{
return;
}
// TODO: This should really be an IllegalArgumentException but old database files
// with index-based FreespaceManagers appear to deliver zeroed slots.
// throw new IllegalArgumentException();
if (_freespaceManager == null)
{
// Can happen on early free before freespacemanager
// is up, during conversion.
return;
}
if (DTrace.enabled)
{
DTrace.FileFree.LogLength(slot.Address(), slot.Length());
}
_freespaceManager.Free(slot);
}
示例12: WritePointer
public virtual void WritePointer(int id, Slot slot)
{
if (DTrace.enabled)
{
DTrace.WritePointer.Log(id);
DTrace.WritePointer.LogLength(slot);
}
_pointerIo.Seek(0);
_pointerIo.WriteInt(slot.Address());
_pointerIo.WriteInt(slot.Length());
WriteBytes(_pointerIo, id, 0);
}
示例13: WriteSlot
private void WriteSlot(ByteArrayBuffer buffer, Slot slot, bool writeZero)
{
if (writeZero || slot == null)
{
buffer.WriteInt(0);
buffer.WriteInt(0);
return;
}
buffer.WriteInt(slot.Address());
buffer.WriteInt(slot.Length());
}
示例14: MappingTree
public MappingTree(Slot slot, ConsistencyChecker.SlotSource source) : base(slot.Address
(), new ConsistencyChecker.SlotWithSource(slot, source))
{
}
示例15: ToNonBlockedLength
public Slot ToNonBlockedLength(Slot slot)
{
return new Slot(slot.Address(), BlocksToBytes(slot.Length()));
}