Ejemplo n.º 1
0
 internal void RevertWritingTransaction(IRootNode currentArtRoot)
 {
     lock (_writeLock)
     {
         currentArtRoot.Dispose();
         _writingTransaction = null;
         TryDequeWaiterForWritingTransaction();
     }
 }
Ejemplo n.º 2
0
        void NewWrittingTransactionUnsafe(TaskCompletionSource <IKeyValueDBTransaction> tcs)
        {
            FreeWaitingToDispose();
            var newTransactionRoot = LastCommited;

            _lastCommited       = newTransactionRoot.Snapshot();
            _writingTransaction = new ArtInMemoryKeyValueDBTransaction(this, newTransactionRoot, true, false);
            tcs.TrySetResult(_writingTransaction);
        }
Ejemplo n.º 3
0
 internal void CommitWrittingTransaction(IRootNode artRoot)
 {
     lock (_writeLock)
     {
         _writingTransaction = null;
         if (_lastCommited.Dereference())
         {
             _lastCommited.Dispose();
         }
         _lastCommited = artRoot;
         TryDequeWaiterForWrittingTransaction();
     }
 }
Ejemplo n.º 4
0
 internal void RevertWrittingTransaction(IRootNode currentArtRoot)
 {
     lock (_writeLock)
     {
         currentArtRoot.RevertTo(_lastCommited);
         if (_lastCommited.Dereference())
         {
             _lastCommited.Dispose();
         }
         _lastCommited       = currentArtRoot;
         _writingTransaction = null;
         TryDequeWaiterForWrittingTransaction();
     }
 }
Ejemplo n.º 5
0
        ArtInMemoryKeyValueDBTransaction NewWritingTransactionUnsafe()
        {
            FreeWaitingToDispose();
            var newTransactionRoot = _lastCommited.CreateWritableTransaction();

            try
            {
                var tr = new ArtInMemoryKeyValueDBTransaction(this, newTransactionRoot, true, false);
                _writingTransaction = tr;
                return(tr);
            }
            catch
            {
                newTransactionRoot.Dispose();
                throw;
            }
        }
Ejemplo n.º 6
0
 internal IRootNode MakeWritableTransaction(ArtInMemoryKeyValueDBTransaction keyValueDBTransaction,
                                            IRootNode artRoot)
 {
     lock (_writeLock)
     {
         if (_writingTransaction != null)
         {
             throw new BTDBTransactionRetryException("Another writing transaction already running");
         }
         if (_lastCommited != artRoot)
         {
             throw new BTDBTransactionRetryException("Another writing transaction already finished");
         }
         _writingTransaction = keyValueDBTransaction;
         var result = _lastCommited.CreateWritableTransaction();
         DereferenceRoot(artRoot);
         return(result);
     }
 }