private long IdSystemUsage()
        {
            IIdSystem idSystem = _db.IdSystem();
            long      usage    = 0;

            while (idSystem is BTreeIdSystem)
            {
                IIdSystem parentIdSystem = ((IIdSystem)FieldValue(idSystem, "_parentIdSystem"));
                usage += BTreeUsage(_db.SystemTransaction(), parentIdSystem, (BTree)FieldValue(idSystem
                                                                                               , "_bTree"), _slots);
                PersistentIntegerArray persistentState = (PersistentIntegerArray)FieldValue(idSystem
                                                                                            , "_persistentState");
                int persistentStateId = persistentState.GetID();
                Db4objects.Db4o.Internal.Slots.Slot persistentStateSlot = parentIdSystem.CommittedSlot
                                                                              (persistentStateId);
                _slots.Add(persistentStateSlot);
                usage   += persistentStateSlot.Length();
                idSystem = parentIdSystem;
            }
            if (idSystem is InMemoryIdSystem)
            {
                Db4objects.Db4o.Internal.Slots.Slot idSystemSlot = ((Db4objects.Db4o.Internal.Slots.Slot
                                                                     )FieldValue(idSystem, "_slot"));
                usage += idSystemSlot.Length();
                _slots.Add(idSystemSlot);
            }
            return(usage);
        }
Example #2
0
 private void InitializeNew()
 {
     CreateBTrees(0, 0);
     _slotsByAddress.Write(Transaction());
     _slotsByLength.Write(Transaction());
     int[] ids = new int[] { _slotsByAddress.GetID(), _slotsByLength.GetID() };
     _idArray = new PersistentIntegerArray(SlotChangeFactory.FreeSpace, _idSystem, ids
                                           );
     _idArray.Write(Transaction());
     _file.SystemData().BTreeFreespaceId(_idArray.GetID());
 }
Example #3
0
        private void InitializeNew()
        {
            _bTree = new BTree(Transaction(), BTreeConfiguration(), new BTreeIdSystem.IdSlotMappingHandler
                                   ());
            int idGeneratorValue = _container.Handlers.LowestValidId() - 1;

            _persistentState = new PersistentIntegerArray(SlotChangeFactory.IdSystem, _transactionalIdSystem
                                                          , new int[] { _bTree.GetID(), idGeneratorValue, 0 });
            _persistentState.Write(Transaction());
            _parentIdSystem.ChildId(_persistentState.GetID());
        }
Example #4
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))));
            }
        }
Example #5
0
 public override void Write(LocalObjectContainer container)
 {
     try
     {
         BeginDelegation();
         _delegate.Write(container);
         container.SystemData().BTreeFreespaceId(_idArray.GetID());
     }
     finally
     {
         EndDelegation();
     }
 }
Example #6
0
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            int[] original             = new int[] { 10, 99, 77 };
            PersistentIntegerArray arr = new PersistentIntegerArray(SlotChangeFactory.IdSystem
                                                                    , null, original);

            arr.Write(SystemTrans());
            int id = arr.GetID();

            Reopen();
            arr = new PersistentIntegerArray(SlotChangeFactory.IdSystem, null, id);
            arr.Read(SystemTrans());
            int[] copy = arr.Array();
            ArrayAssert.AreEqual(original, copy);
        }
Example #7
0
 private void InitializeNew()
 {
     _bTree = new BTree(Transaction(), BTreeConfiguration(), new IdSlotMappingHandler
         ());
     var idGeneratorValue = _container.Handlers.LowestValidId() - 1;
     _persistentState = new PersistentIntegerArray(SlotChangeFactory.IdSystem, _transactionalIdSystem
         , new[] {_bTree.GetID(), idGeneratorValue, 0});
     _persistentState.Write(Transaction());
     _parentIdSystem.ChildId(_persistentState.GetID());
 }
Example #8
0
 private void InitializeNew()
 {
     CreateBTrees(0, 0);
     _slotsByAddress.Write(Transaction());
     _slotsByLength.Write(Transaction());
     int[] ids = {_slotsByAddress.GetID(), _slotsByLength.GetID()};
     _idArray = new PersistentIntegerArray(SlotChangeFactory.FreeSpace, _idSystem, ids
         );
     _idArray.Write(Transaction());
     _file.SystemData().BTreeFreespaceId(_idArray.GetID());
 }