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


C# Slot.Length方法代码示例

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


在下文中一共展示了Slot.Length方法的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
         ());
 }
开发者ID:masroore,项目名称:db4o,代码行数:27,代码来源:UUIDFieldMetadata.cs

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

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

示例4: StatefulBuffer

 public StatefulBuffer(Transaction trans, Slot
     slot) : this(trans, slot.Address(), slot.Length())
 {
 }
开发者ID:masroore,项目名称:db4o,代码行数:4,代码来源:StatefulBuffer.cs

示例5: UseSlot

 public void UseSlot(Slot slot)
 {
     _address = slot.Address();
     _offset = 0;
     if (slot.Length() > _buffer.Length)
     {
         _buffer = new byte[slot.Length()];
     }
     _length = slot.Length();
 }
开发者ID:masroore,项目名称:db4o,代码行数:10,代码来源:StatefulBuffer.cs

示例6: OverwriteDeletedBlockedSlot

		public virtual void OverwriteDeletedBlockedSlot(Slot slot)
		{
			OverwriteDeletedBytes(slot.Address(), _blockConverter.BlocksToBytes(slot.Length()
				));
		}
开发者ID:erdincay,项目名称:db4o,代码行数:5,代码来源:LocalObjectContainer.cs

示例7: WriteThis

		private void WriteThis(Slot reservedSlot)
		{
			// We need a little dance here to keep filling free slots
			// with X bytes. The FreespaceManager would do it immediately
			// upon the free call, but then our CrashSimulatingTestCase
			// fails because we have the Xses in the file before flushing.
			Slot xByteSlot = null;
			int slotLength = SlotLength();
			if (reservedSlot.Length() >= slotLength)
			{
				_slot = reservedSlot;
				reservedSlot = null;
			}
			else
			{
				_slot = AllocateSlot(true, slotLength);
			}
			ByteArrayBuffer buffer = new ByteArrayBuffer(_slot.Length());
			buffer.WriteInt(_childId);
			_idGenerator.Write(buffer);
			TreeInt.Write(buffer, _ids);
			_container.WriteBytes(buffer, _slot.Address(), 0);
			_container.SystemData().IdSystemSlot(_slot);
			IRunnable commitHook = _container.CommitHook();
			_container.SyncFiles(commitHook);
			FreeSlot(reservedSlot);
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:27,代码来源:InMemoryIdSystem.cs

示例8: 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);
			}
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:20,代码来源:IoAdaptedObjectContainer.cs

示例9: SlotLongEnoughForLog

 private bool SlotLongEnoughForLog(int slotChangeCount, Slot slot)
 {
     return slot != null && slot.Length() >= TransactionLogSlotLength(slotChangeCount);
 }
开发者ID:masroore,项目名称:db4o,代码行数:4,代码来源:EmbeddedTransactionLogHandler.cs

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

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

示例12: ToNonBlockedLength

		public Slot ToNonBlockedLength(Slot slot)
		{
			return new Slot(slot.Address(), BlocksToBytes(slot.Length()));
		}
开发者ID:Galigator,项目名称:db4o,代码行数:4,代码来源:BlockSizeBlockConverter.cs

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

示例14: AddSlot

		private void AddSlot(Slot slot)
		{
			_slotsByLength.Add(Transaction(), slot);
			_slotsByAddress.Add(Transaction(), slot);
			_listener.SlotAdded(slot.Length());
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:6,代码来源:BTreeFreespaceManager.cs

示例15: RemoveSlot

		// do nothing
		// reading happens in start( )
		private void RemoveSlot(Slot slot)
		{
			_slotsByLength.Remove(Transaction(), slot);
			_slotsByAddress.Remove(Transaction(), slot);
			_listener.SlotRemoved(slot.Length());
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:8,代码来源:BTreeFreespaceManager.cs


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