Beispiel #1
0
		public virtual Tree Free(LocalObjectContainer file, Tree treeRoot, Db4objects.Db4o.Internal.Slots.Slot
			 slot)
		{
			file.Free(_slot.Address(), _slot.Length());
			if (RemoveReferenceIsLast())
			{
				if (treeRoot != null)
				{
					return treeRoot.RemoveNode(this);
				}
			}
			PointTo(slot);
			return treeRoot;
		}
		public override void Write(LocalObjectContainer container)
		{
			Slot slot = container.AllocateSlot(MarshalledLength());
			while (slot.Length() < MarshalledLength())
			{
				// This can happen if DatabaseGrowthSize is configured.
				// Allocating a slot may produce an additional entry
				// in this FreespaceManager.
				container.Free(slot);
				slot = container.AllocateSlot(MarshalledLength());
			}
			ByteArrayBuffer buffer = new ByteArrayBuffer(slot.Length());
			TreeInt.Write(buffer, (TreeInt)_freeBySize);
			container.WriteEncrypt(buffer, slot.Address(), 0);
			container.SystemData().InMemoryFreespaceSlot(slot);
		}
		public override void Read(LocalObjectContainer container, Slot slot)
		{
			if (Slot.IsNull(slot))
			{
				return;
			}
			ByteArrayBuffer buffer = container.ReadBufferBySlot(slot);
			if (buffer == null)
			{
				return;
			}
			Read(buffer);
			container.Free(slot);
		}