Esempio n. 1
0
		public PersistentIntegerArray(Db4objects.Db4o.Internal.Slots.SlotChangeFactory slotChangeFactory
			, ITransactionalIdSystem idSystem, int[] arr) : base(idSystem)
		{
			_slotChangeFactory = slotChangeFactory;
			_ints = new int[arr.Length];
			System.Array.Copy(arr, 0, _ints, 0, arr.Length);
		}
Esempio n. 2
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. 3
0
 public BTreeFreespaceManager(LocalObjectContainer file, IProcedure4 slotFreedCallback
                              , int discardLimit) : base(slotFreedCallback, discardLimit)
 {
     _file     = file;
     _delegate = new InMemoryFreespaceManager(slotFreedCallback, discardLimit);
     _idSystem = file.SystemData().FreespaceIdSystem();
 }
Esempio n. 4
0
 public PersistentIntegerArray(Db4objects.Db4o.Internal.Slots.SlotChangeFactory slotChangeFactory
                               , ITransactionalIdSystem idSystem, int[] arr) : base(idSystem)
 {
     _slotChangeFactory = slotChangeFactory;
     _ints = new int[arr.Length];
     System.Array.Copy(arr, 0, _ints, 0, arr.Length);
 }
		public BTreeFreespaceManager(LocalObjectContainer file, IProcedure4 slotFreedCallback
			, int discardLimit) : base(slotFreedCallback, discardLimit)
		{
			_file = file;
			_delegate = new InMemoryFreespaceManager(slotFreedCallback, discardLimit);
			_idSystem = file.SystemData().FreespaceIdSystem();
		}
Esempio n. 6
0
 public _IClosure4_58(IObjectContainer client, Lock4 Lock, ITransactionalIdSystem
                      idSystem, int prefetchedID)
 {
     this.client       = client;
     this.Lock         = Lock;
     this.idSystem     = idSystem;
     this.prefetchedID = prefetchedID;
 }
Esempio n. 7
0
 public BTreeConfiguration(ITransactionalIdSystem idSystem, SlotChangeFactory slotChangeFactory
     , int cacheSize, bool canEnlistWithTransaction)
 {
     _idSystem = idSystem;
     _slotChangeFactory = slotChangeFactory;
     _canEnlistWithTransaction = canEnlistWithTransaction;
     _cacheSize = cacheSize;
 }
Esempio n. 8
0
 public LocalTransaction(ObjectContainerBase container, Transaction parentTransaction
                         , ITransactionalIdSystem idSystem, IReferenceSystem referenceSystem) : base(container
                                                                                                     , parentTransaction, referenceSystem)
 {
     _file = (LocalObjectContainer)container;
     _committedCallbackDispatcher = new _ICommittedCallbackDispatcher_39(this);
     _idSystem = idSystem;
 }
Esempio n. 9
0
 public BTreeConfiguration(ITransactionalIdSystem idSystem, SlotChangeFactory slotChangeFactory
                           , int cacheSize, bool canEnlistWithTransaction)
 {
     _idSystem                 = idSystem;
     _slotChangeFactory        = slotChangeFactory;
     _canEnlistWithTransaction = canEnlistWithTransaction;
     _cacheSize                = cacheSize;
 }
Esempio n. 10
0
 public LocalTransaction(ObjectContainerBase container, Transaction parentTransaction
     , ITransactionalIdSystem idSystem, IReferenceSystem referenceSystem) : base(container
         , parentTransaction, referenceSystem)
 {
     _file = (LocalObjectContainer) container;
     _committedCallbackDispatcher = new _ICommittedCallbackDispatcher_39(this);
     _idSystem = idSystem;
 }
Esempio n. 11
0
        private void FreeAllNodeIds(LocalTransaction systemTrans, IEnumerator allNodeIDs)
        {
            ITransactionalIdSystem idSystem = IdSystem(systemTrans);

            while (allNodeIDs.MoveNext())
            {
                int id = ((int)allNodeIDs.Current);
                idSystem.NotifySlotDeleted(id, SlotChangeFactory());
            }
        }
        public override Transaction NewTransaction(Transaction parentTransaction, IReferenceSystem
                                                   referenceSystem, bool isSystemTransaction)
        {
            ITransactionalIdSystem systemIdSystem = null;

            if (!isSystemTransaction)
            {
                systemIdSystem = SystemTransaction().IdSystem();
            }
            IClosure4 idSystem = new _IClosure4_58(this);
            ITransactionalIdSystem transactionalIdSystem = NewTransactionalIdSystem(systemIdSystem
                                                                                    , idSystem);

            return(new LocalTransaction(this, parentTransaction, transactionalIdSystem, referenceSystem
                                        ));
        }
Esempio n. 13
0
        public Msg ReplyFromServer()
        {
            int  prefetchIDCount = ReadInt();
            MsgD reply           = Msg.IdList.GetWriterForLength(Transaction(), Const4.IntLength * prefetchIDCount
                                                                 );

            lock (ContainerLock())
            {
                ITransactionalIdSystem idSystem = Transaction().IdSystem();
                for (int i = 0; i < prefetchIDCount; i++)
                {
                    reply.WriteInt(idSystem.PrefetchID());
                }
            }
            return(reply);
        }
		public BTreeIdSystem(LocalObjectContainer container, IStackableIdSystem parentIdSystem
			, int maxValidId)
		{
			_container = container;
			_parentIdSystem = parentIdSystem;
			_transactionalIdSystem = container.NewTransactionalIdSystem(null, new _IClosure4_40
				(parentIdSystem));
			int persistentArrayId = parentIdSystem.ChildId();
			if (persistentArrayId == 0)
			{
				InitializeNew();
			}
			else
			{
				InitializeExisting(persistentArrayId);
			}
			_idGenerator = new SequentialIdGenerator(new _IFunction4_52(this), IdGeneratorValue
				(), _container.Handlers.LowestValidId(), maxValidId);
		}
Esempio n. 15
0
        public virtual void Close(bool rollbackOnClose)
        {
            if (Container() != null)
            {
                CheckSynchronization();
                Container().ReleaseSemaphores(this);
                DiscardReferenceSystem();
            }
            if (rollbackOnClose)
            {
                Rollback();
            }
            ITransactionalIdSystem idSystem = IdSystem();

            if (idSystem != null)
            {
                idSystem.Close();
            }
        }
Esempio n. 16
0
        public BTreeIdSystem(LocalObjectContainer container, IStackableIdSystem parentIdSystem
                             , int maxValidId)
        {
            _container             = container;
            _parentIdSystem        = parentIdSystem;
            _transactionalIdSystem = container.NewTransactionalIdSystem(null, new _IClosure4_40
                                                                            (parentIdSystem));
            int persistentArrayId = parentIdSystem.ChildId();

            if (persistentArrayId == 0)
            {
                InitializeNew();
            }
            else
            {
                InitializeExisting(persistentArrayId);
            }
            _idGenerator = new SequentialIdGenerator(new _IFunction4_52(this), IdGeneratorValue
                                                         (), _container.Handlers.LowestValidId(), maxValidId);
        }
Esempio n. 17
0
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            ObjectServerImpl server = (ObjectServerImpl)Db4oClientServer.OpenServer(TempFile(
                                                                                        ), Db4oClientServer.ArbitraryPort);
            Lock4 Lock = new Lock4();

            server.ClientDisconnected += new System.EventHandler <Db4objects.Db4o.Events.StringEventArgs>
                                             (new _IEventListener4_39(Lock).OnEvent);
            server.GrantAccess(User, Password);
            IObjectContainer            client        = OpenClient(server.Port());
            ServerMessageDispatcherImpl msgDispatcher = FirstMessageDispatcherFor(server);
            Transaction            transaction        = msgDispatcher.Transaction();
            ITransactionalIdSystem idSystem           = transaction.IdSystem();
            int prefetchedID = idSystem.PrefetchID();

            Assert.IsGreater(0, prefetchedID);
            Lock.Run(new _IClosure4_58(client, Lock, idSystem, prefetchedID));
            // This wont work with the PointerBasedIdSystem
            server.Close();
        }
 public LocalPersistentBase(ITransactionalIdSystem idSystem)
 {
     _idSystem = idSystem;
 }
Esempio n. 19
0
 public LocalPersistentBase(ITransactionalIdSystem idSystem)
 {
     _idSystem = idSystem;
 }
Esempio n. 20
0
 public PersistentIntegerArray(SlotChangeFactory slotChangeFactory
                               , ITransactionalIdSystem idSystem, int id) : base(idSystem)
 {
     _slotChangeFactory = slotChangeFactory;
     SetID(id);
 }
			public _IClosure4_58(IObjectContainer client, Lock4 Lock, ITransactionalIdSystem 
				idSystem, int prefetchedID)
			{
				this.client = client;
				this.Lock = Lock;
				this.idSystem = idSystem;
				this.prefetchedID = prefetchedID;
			}
Esempio n. 22
0
 public BTreeConfiguration(ITransactionalIdSystem idSystem, int cacheSize, bool canEnlistWithTransaction
                           ) : this(idSystem, SlotChangeFactory.SystemObjects, cacheSize, canEnlistWithTransaction
                                    )
 {
 }
Esempio n. 23
0
 public PersistentIntegerArray(Db4objects.Db4o.Internal.Slots.SlotChangeFactory slotChangeFactory
                               , ITransactionalIdSystem idSystem, int id) : base(idSystem)
 {
     _slotChangeFactory = slotChangeFactory;
     SetID(id);
 }
Esempio n. 24
0
		public virtual void FreespaceIdSystem(ITransactionalIdSystem transactionalIdSystem
			)
		{
			_freespaceIdSystem = transactionalIdSystem;
		}
Esempio n. 25
0
 public virtual void FreespaceIdSystem(ITransactionalIdSystem transactionalIdSystem
                                       )
 {
     _freespaceIdSystem = transactionalIdSystem;
 }
Esempio n. 26
0
 public BTreeConfiguration(ITransactionalIdSystem idSystem, int cacheSize, bool canEnlistWithTransaction
     ) : this(idSystem, SlotChangeFactory.SystemObjects, cacheSize, canEnlistWithTransaction
         )
 {
 }
 public virtual ITransactionalIdSystem NewTransactionalIdSystem(ITransactionalIdSystem
                                                                systemIdSystem, IClosure4 idSystem)
 {
     return(new TransactionalIdSystemImpl(new _IClosure4_69(this), idSystem, (TransactionalIdSystemImpl
                                                                              )systemIdSystem));
 }
		internal TransactionObjectCarrier(ObjectContainerBase container, Transaction parentTransaction
			, ITransactionalIdSystem idSystem, IReferenceSystem referenceSystem) : base(container
			, parentTransaction, idSystem, referenceSystem)
		{
			_idSystem = idSystem;
		}
Esempio n. 29
0
		public virtual ITransactionalIdSystem NewTransactionalIdSystem(ITransactionalIdSystem
			 systemIdSystem, IClosure4 idSystem)
		{
			return new TransactionalIdSystemImpl(new _IClosure4_69(this), idSystem, (TransactionalIdSystemImpl
				)systemIdSystem);
		}
Esempio n. 30
0
 public virtual void TransactionalIdSystem(ITransactionalIdSystem transactionalIdSystem
     )
 {
     _transactionalIdSystem = transactionalIdSystem;
 }
Esempio n. 31
0
		public PersistentIntegerArray(Db4objects.Db4o.Internal.Slots.SlotChangeFactory slotChangeFactory
			, ITransactionalIdSystem idSystem, int id) : base(idSystem)
		{
			_slotChangeFactory = slotChangeFactory;
			SetID(id);
		}
				public _ICodeBlock_63(ITransactionalIdSystem idSystem, int prefetchedID)
				{
					this.idSystem = idSystem;
					this.prefetchedID = prefetchedID;
				}
 public virtual void TransactionalIdSystem(ITransactionalIdSystem transactionalIdSystem
                                           )
 {
     _transactionalIdSystem = transactionalIdSystem;
 }
Esempio n. 34
0
 internal TransactionObjectCarrier(ObjectContainerBase container, Transaction parentTransaction
                                   , ITransactionalIdSystem idSystem, IReferenceSystem referenceSystem) : base(container
                                                                                                               , parentTransaction, idSystem, referenceSystem)
 {
     _idSystem = idSystem;
 }
Esempio n. 35
0
 public _ICodeBlock_63(ITransactionalIdSystem idSystem, int prefetchedID)
 {
     this.idSystem     = idSystem;
     this.prefetchedID = prefetchedID;
 }
Esempio n. 36
0
 public PersistentIntegerArray(SlotChangeFactory slotChangeFactory
     , ITransactionalIdSystem idSystem, int id) : base(idSystem)
 {
     _slotChangeFactory = slotChangeFactory;
     SetID(id);
 }