当前位置: 首页>>代码示例>>C#>>正文


C# Slots.Slot类代码示例

本文整理汇总了C#中Db4objects.Db4o.Internal.Slots.Slot的典型用法代码示例。如果您正苦于以下问题:C# Slot类的具体用法?C# Slot怎么用?C# Slot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Slot类属于Db4objects.Db4o.Internal.Slots命名空间,在下文中一共展示了Slot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

 // _key, _slot._address, _slot._length 
 public override object Read(ByteArrayBuffer buffer)
 {
     var id = buffer.ReadInt();
     var slot = new Slot
         (buffer.ReadInt(), buffer.ReadInt());
     return new IdSlotTree(id, slot);
 }
开发者ID:masroore,项目名称:db4o,代码行数:8,代码来源:IdSlotTree.cs

示例2: 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
         ());
 }
开发者ID:masroore,项目名称:db4o,代码行数:27,代码来源:UUIDFieldMetadata.cs

示例3: ApplySlotChanges

 public override void ApplySlotChanges(IVisitable slotChangeTree, int slotChangeCount
     , Slot reservedSlot)
 {
     if (slotChangeCount > 0)
     {
         var transactionLogSlot = SlotLongEnoughForLog(slotChangeCount, reservedSlot)
             ? reservedSlot
             : AllocateSlot(true, slotChangeCount);
         var buffer = new StatefulBuffer(_container.SystemTransaction(), transactionLogSlot
             );
         buffer.WriteInt(transactionLogSlot.Length());
         buffer.WriteInt(slotChangeCount);
         AppendSlotChanges(buffer, slotChangeTree);
         buffer.Write();
         var commitHook = _container.CommitHook();
         FlushDatabaseFile();
         _container.WriteTransactionPointer(transactionLogSlot.Address());
         FlushDatabaseFile();
         if (WriteSlots(slotChangeTree))
         {
             FlushDatabaseFile();
         }
         _container.WriteTransactionPointer(0);
         commitHook.Run();
         FlushDatabaseFile();
         if (transactionLogSlot != reservedSlot)
         {
             FreeSlot(transactionLogSlot);
         }
     }
     FreeSlot(reservedSlot);
 }
开发者ID:masroore,项目名称:db4o,代码行数:32,代码来源:EmbeddedTransactionLogHandler.cs

示例4: SlotFreed

 public virtual void SlotFreed(Slot slot)
 {
     if (_slotFreedCallback == null)
     {
         return;
     }
     _slotFreedCallback.Apply(slot);
 }
开发者ID:masroore,项目名称:db4o,代码行数:8,代码来源:AbstractFreespaceManager.cs

示例5: GetByteLoad

 public override ByteArrayBuffer GetByteLoad()
 {
     var address = _payLoad.ReadInt();
     var length = _payLoad.Length() - (Const4.IntLength);
     var slot = new Slot(address, length);
     _payLoad.RemoveFirstBytes(Const4.IntLength);
     _payLoad.UseSlot(slot);
     return _payLoad;
 }
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:MReadSlot.cs

示例6: GetByteLoad

		public sealed override ByteArrayBuffer GetByteLoad()
		{
			int address = _payLoad.ReadInt();
			int length = _payLoad.Length() - (Const4.IntLength);
			Slot slot = new Slot(address, length);
			_payLoad.RemoveFirstBytes(Const4.IntLength);
			_payLoad.UseSlot(slot);
			return this._payLoad;
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:9,代码来源:MReadSlot.cs

示例7: HandledAsReAdd

		private bool HandledAsReAdd(Slot slot)
		{
			if (!Slot.IsNull(slot))
			{
				return false;
			}
			_clazz.AddToIndex(_transaction, _id);
			return true;
		}
开发者ID:Galigator,项目名称:db4o,代码行数:9,代码来源:WriteUpdateProcessor.cs

示例8: TestAllocateSlot

		public virtual void TestAllocateSlot()
		{
			Slot slot = new Slot(1, 15);
			_nonBlocked.Free(slot);
			Slot allocatedSlot = _nonBlocked.AllocateSlot(8);
			int expectedAllocatedSlotLength = _blockConverter.BlockAlignedBytes(8);
			Slot expectedSlot = new Slot(1, expectedAllocatedSlotLength);
			Assert.AreEqual(expectedSlot, allocatedSlot);
		}
开发者ID:erdincay,项目名称:db4o,代码行数:9,代码来源:BlockAwareFreespaceManagerTestCase.cs

示例9: Free

		// do nothing
		public override void Free(Slot slot)
		{
			int address = slot.Address();
			if (address <= 0)
			{
				throw new ArgumentException();
			}
			int length = slot.Length();
			if (DTrace.enabled)
			{
				DTrace.FreespacemanagerRamFree.LogLength(address, length);
			}
			_finder._key = address;
			FreeSlotNode sizeNode;
			FreeSlotNode addressnode = (FreeSlotNode)Tree.FindSmaller(_freeByAddress, _finder
				);
			if ((addressnode != null) && ((addressnode._key + addressnode._peer._key) == address
				))
			{
				sizeNode = addressnode._peer;
				RemoveFromFreeBySize(sizeNode);
				sizeNode._key += length;
				FreeSlotNode secondAddressNode = (FreeSlotNode)Tree.FindGreaterOrEqual(_freeByAddress
					, _finder);
				if ((secondAddressNode != null) && (address + length == secondAddressNode._key))
				{
					sizeNode._key += secondAddressNode._peer._key;
					RemoveFromBothTrees(secondAddressNode._peer);
				}
				sizeNode.RemoveChildren();
				AddToFreeBySize(sizeNode);
			}
			else
			{
				addressnode = (FreeSlotNode)Tree.FindGreaterOrEqual(_freeByAddress, _finder);
				if ((addressnode != null) && (address + length == addressnode._key))
				{
					sizeNode = addressnode._peer;
					RemoveFromBothTrees(sizeNode);
					sizeNode._key += length;
					addressnode._key = address;
					addressnode.RemoveChildren();
					sizeNode.RemoveChildren();
					_freeByAddress = Tree.Add(_freeByAddress, addressnode);
					AddToFreeBySize(sizeNode);
				}
				else
				{
					if (CanDiscard(length))
					{
						return;
					}
					AddFreeSlotNodes(address, length);
				}
			}
			SlotFreed(slot);
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:58,代码来源:InMemoryFreespaceManager.cs

示例10: 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());
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:10,代码来源:StringHandlerTestCase.cs

示例11: DelayedFree

 public virtual void DelayedFree(Slot slot, bool freeToSystemFreeSpaceSystem)
 {
     if (freeToSystemFreeSpaceSystem)
     {
         _freeToSystemFreespaceSystem.Add(slot);
     }
     else
     {
         _freeToUserFreespaceSystem.Add(slot);
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:11,代码来源:FreespaceCommitter.cs

示例12: AssertAllocateSlot

		private void AssertAllocateSlot(int freeSlotSize, int requiredSlotSize, int expectedSlotSize
			)
		{
			Slot slot = new Slot(1, freeSlotSize);
			_nonBlocked.Free(slot);
			Slot allocatedSlot = _nonBlocked.AllocateSlot(requiredSlotSize);
			int expectedAllocatedSlotLength = _blockConverter.BlockAlignedBytes(expectedSlotSize
				);
			Slot expectedSlot = new Slot(1, expectedAllocatedSlotLength);
			Assert.AreEqual(expectedSlot, allocatedSlot);
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:11,代码来源:FreespaceRemainderLimitTestCase.cs

示例13: TestToNonBlockedLength

 public virtual void TestToNonBlockedLength()
 {
     int[] blocks = {0, 1, 8, 9};
     int[] bytes = {0, 8, 64, 72};
     for (var i = 0; i < blocks.Length; i++)
     {
         var blockedSlot = new Slot(0, blocks[i]);
         var byteSlot = new Slot(0, bytes[i]);
         Assert.AreEqual(byteSlot, blockConverter.ToNonBlockedLength(blockedSlot));
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:11,代码来源:BlockConverterTestCase.cs

示例14: TestToBlockedLength

 public virtual void TestToBlockedLength()
 {
     int[] bytes = {0, 1, 2, 7, 8, 9, 16, 17, 799, 800, 801};
     int[] blocks = {0, 1, 1, 1, 1, 2, 2, 3, 100, 100, 101};
     for (var i = 0; i < bytes.Length; i++)
     {
         var byteSlot = new Slot(0, bytes[i]);
         var blockedSlot = new Slot(0, blocks[i]);
         Assert.AreEqual(blockedSlot, blockConverter.ToBlockedLength(byteSlot));
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:11,代码来源:BlockConverterTestCase.cs

示例15: FreeSlot

 private void FreeSlot(Slot slot)
 {
     if (slot == null)
     {
         return;
     }
     if (_container.FreespaceManager() == null)
     {
         return;
     }
     _container.FreespaceManager().FreeSafeSlot(slot);
 }
开发者ID:masroore,项目名称:db4o,代码行数:12,代码来源:EmbeddedTransactionLogHandler.cs


注:本文中的Db4objects.Db4o.Internal.Slots.Slot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。