public virtual void Write(Transaction trans) { if (!WriteObjectBegin()) { return; } try { LocalObjectContainer container = (LocalObjectContainer)trans.Container(); if (DTrace.enabled) { DTrace.PersistentOwnLength.Log(GetID()); } int length = OwnLength(); length = container.BlockConverter().BlockAlignedBytes(length); Slot slot = container.AllocateSlot(length); if (IsNew()) { SetID(IdSystem(trans).NewId(SlotChangeFactory())); IdSystem(trans).NotifySlotCreated(_id, slot, SlotChangeFactory()); } else { IdSystem(trans).NotifySlotUpdated(_id, slot, SlotChangeFactory()); } if (DTrace.enabled) { DTrace.PersistentBaseNewSlot.LogLength(GetID(), slot); } ByteArrayBuffer writer = ProduceWriteBuffer(trans, length); WriteToFile(trans, writer, slot); } finally { EndProcessing(); } }
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 static int InitSlot(LocalObjectContainer file) { int address = file.AllocateSlot(SlotLength()).Address(); SlotEntryToZeroes(file, address); return address; }