/// <exception cref="System.Exception"></exception> public static void AssertAllSlotsFreed(LocalTransaction trans, BTree bTree, ICodeBlock block) { LocalObjectContainer container = (LocalObjectContainer)trans.Container(); ITransactionalIdSystem idSystem = trans.IdSystem(); IEnumerator allSlotIDs = bTree.AllNodeIds(trans.SystemTransaction()); Collection4 allSlots = new Collection4(); while (allSlotIDs.MoveNext()) { int slotID = ((int)allSlotIDs.Current); Slot slot = idSystem.CurrentSlot(slotID); allSlots.Add(slot); } Slot bTreeSlot = idSystem.CurrentSlot(bTree.GetID()); allSlots.Add(bTreeSlot); Collection4 freedSlots = new Collection4(); IFreespaceManager freespaceManager = container.FreespaceManager(); container.InstallDebugFreespaceManager(new FreespaceManagerForDebug(new _ISlotListener_99 (freedSlots))); block.Run(); container.InstallDebugFreespaceManager(freespaceManager); Assert.IsTrue(freedSlots.ContainsAll(allSlots.GetEnumerator())); }
private static long BTreeUsage(Transaction transaction, IIdSystem idSystem, BTree btree, ISlotMap slotMap) { IEnumerator nodeIter = btree.AllNodeIds(transaction); Db4objects.Db4o.Internal.Slots.Slot btreeSlot = idSystem.CommittedSlot(btree.GetID ()); slotMap.Add(btreeSlot); long usage = btreeSlot.Length(); while (nodeIter.MoveNext()) { int curNodeId = ((int)nodeIter.Current); Db4objects.Db4o.Internal.Slots.Slot slot = idSystem.CommittedSlot(curNodeId); slotMap.Add(slot); usage += slot.Length(); } return usage; }
public virtual void TraverseAllIndexSlots(BTree btree, IVisitor4 command) { IEnumerator slotIDIter = btree.AllNodeIds(Sourcedb.Transaction(this)); while (slotIDIter.MoveNext()) { command.Visit(slotIDIter.Current); } }
private static long BTreeUsage(Transaction transaction, IIdSystem idSystem, BTree btree, ISlotMap slotMap) { var nodeIter = btree.AllNodeIds(transaction); var btreeSlot = idSystem.CommittedSlot(btree.GetID ()); slotMap.Add(btreeSlot); long usage = btreeSlot.Length(); while (nodeIter.MoveNext()) { var curNodeId = ((int) nodeIter.Current); var slot = idSystem.CommittedSlot(curNodeId); slotMap.Add(slot); usage += slot.Length(); } return usage; }