Example #1
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 #2
0
 public virtual void Commit(IVisitable slotChanges, FreespaceCommitter freespaceCommitter
                            )
 {
     _container.FreespaceManager().BeginCommit();
     slotChanges.Accept(new _IVisitor4_129(this));
     // TODO: Maybe we want a BTree that doesn't allow duplicates.
     // Then we could do the following in one step without removing first.
     _bTree.Commit(Transaction());
     IdGeneratorValue(_idGenerator.PersistentGeneratorValue());
     if (_idGenerator.IsDirty())
     {
         _idGenerator.SetClean();
         _persistentState.SetStateDirty();
     }
     if (_persistentState.IsDirty())
     {
         _persistentState.Write(Transaction());
     }
     _container.FreespaceManager().EndCommit();
     _transactionalIdSystem.Commit(freespaceCommitter);
     _transactionalIdSystem.Clear();
 }
Example #3
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 #4
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());
 }