Esempio n. 1
0
        /// <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()));
        }
Esempio n. 2
0
        public virtual void TraverseAllIndexSlots(BTree btree, IVisitor4 command)
        {
            IEnumerator slotIDIter = btree.AllNodeIds(Sourcedb.Transaction(this));

            while (slotIDIter.MoveNext())
            {
                command.Visit(slotIDIter.Current);
            }
        }
Esempio n. 3
0
        public virtual void TraverseOwnSlots(IProcedure4 block)
        {
            _parentIdSystem.TraverseOwnSlots(block);
            block.Apply(OwnSlotInfo(_persistentState.GetID()));
            block.Apply(OwnSlotInfo(_bTree.GetID()));
            IEnumerator nodeIds = _bTree.AllNodeIds(_container.SystemTransaction());

            while (nodeIds.MoveNext())
            {
                block.Apply(OwnSlotInfo((((int)nodeIds.Current))));
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
 public override IEnumerator AllSlotIDs(Transaction trans)
 {
     return(_btreeIndex.AllNodeIds(trans));
 }