예제 #1
0
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Commit()
 {
     try
     {
         try
         {
             this.OnClosing(false);
         }
         finally
         {
             try
             {
                 NativeMethods.Execute(lib => lib.mdb_txn_commit(_handle));
             }
             catch (LightningException)
             {
                 this.Abort(false);
                 throw;
             }
             this.State = LightningTransactionState.Commited;
         }
     }
     finally
     {
         this.DetachClosingHandler();
     }
 }
예제 #2
0
        /// <summary>
        /// Reset current transaction.
        /// </summary>
        public void Reset()
        {
            if (!IsReadOnly)
            {
                throw new InvalidOperationException("Can't reset non-readonly transaction");
            }

            Lmdb.mdb_txn_reset(_handle);
            State = LightningTransactionState.Reseted;
        }
예제 #3
0
        /// <summary>
        /// Reset current transaction.
        /// </summary>
        public void Reset()
        {
            if (!this.IsReadOnly)
            {
                throw new InvalidOperationException("Can't reset non-readonly transaction");
            }

            NativeMethods.Library.mdb_txn_reset(_handle);
            this.State = LightningTransactionState.Reseted;
        }
 private void OnParentStateChanging(LightningTransactionState state)
 {
     switch (state)
     {
         case LightningTransactionState.Aborted:
         case LightningTransactionState.Commited:
             Abort();
             break;
         default:
             break;
     }
 }
예제 #5
0
        private void OnParentStateChanging(LightningTransactionState state)
        {
            switch (state)
            {
            case LightningTransactionState.Aborted:
            case LightningTransactionState.Commited:
                Abort();
                break;

            default:
                break;
            }
        }
예제 #6
0
        /// <summary>
        /// Renew current transaction.
        /// </summary>
        public void Renew()
        {
            if (!IsReadOnly)
            {
                throw new InvalidOperationException("Can't renew non-readonly transaction");
            }

            if (State != LightningTransactionState.Reseted)
            {
                throw new InvalidOperationException("Transaction should be reseted first");
            }

            Lmdb.mdb_txn_renew(_handle);
            State = LightningTransactionState.Active;
        }
예제 #7
0
        /// <summary>
        /// Renew current transaction.
        /// </summary>
        public void Renew()
        {
            if (!this.IsReadOnly)
            {
                throw new InvalidOperationException("Can't renew non-readonly transaction");
            }

            if (this.State != LightningTransactionState.Reseted)
            {
                throw new InvalidOperationException("Transaction should be reseted first");
            }

            NativeMethods.Library.mdb_txn_renew(_handle);
            this.State = LightningTransactionState.Active;
        }
예제 #8
0
        /// <summary>
        /// Renew current transaction.
        /// </summary>
        public MDBResultCode Renew()
        {
            if (!IsReadOnly)
            {
                throw new InvalidOperationException("Can't renew non-readonly transaction");
            }

            if (State != LightningTransactionState.Reseted)
            {
                throw new InvalidOperationException("Transaction should be reset first");
            }

            var result = mdb_txn_renew(_handle);

            State = LightningTransactionState.Active;
            return(result);
        }
예제 #9
0
 private void Abort(bool environmentClosing)
 {
     try
     {
         try
         {
             this.OnClosing(environmentClosing);
         }
         finally
         {
             NativeMethods.Library.mdb_txn_abort(_handle);
         }
     }
     finally
     {
         this.DetachClosingHandler();
         this.State = LightningTransactionState.Aborted;
     }
 }
예제 #10
0
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Commit()
 {
     State = LightningTransactionState.Commited;
     StateChanging?.Invoke(State);
     Lmdb.mdb_txn_commit(_handle);
 }
예제 #11
0
        /// <summary>
        /// Commit all the operations of a transaction into the database.
        /// All cursors opened within the transaction will be closed by this call. 
        /// The cursors and transaction handle will be freed and must not be used again after this call.
        /// </summary>
        public void Commit()
        {
            Discard(() =>
            {
                try
                {
                    NativeMethods.Execute(lib => lib.mdb_txn_commit(_handle));

                    this.State = LightningTransactionState.Commited;

                    NotifyDiscarded();
                }
                catch (LightningException)
                {
                    this.Abort();
                    throw;
                }
            });
        }
예제 #12
0
        /// <summary>
        /// Reset current transaction.
        /// </summary>
        public void Reset()
        {
            if (!this.IsReadOnly)
                throw new InvalidOperationException("Can't reset non-readonly transaction");

            NativeMethods.Library.mdb_txn_reset(_handle);
            this.State = LightningTransactionState.Reseted;
        }
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call. 
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Commit()
 {
     State = LightningTransactionState.Commited;
     StateChanging?.Invoke(State);
     mdb_txn_commit(_handle);
 }
 /// <summary>
 /// Abandon all the operations of the transaction instead of saving them.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Abort()
 {
     State = LightningTransactionState.Aborted;
     StateChanging?.Invoke(State);
     mdb_txn_abort(_handle);
 }
        /// <summary>
        /// Renew current transaction.
        /// </summary>
        public void Renew()
        {
            if (!IsReadOnly)
                throw new InvalidOperationException("Can't renew non-readonly transaction");

            if (State != LightningTransactionState.Reseted)
                throw new InvalidOperationException("Transaction should be reseted first");

            mdb_txn_renew(_handle);
            State = LightningTransactionState.Active;
        }
        /// <summary>
        /// Reset current transaction.
        /// </summary>
        public void Reset()
        {
            if (!IsReadOnly)
                throw new InvalidOperationException("Can't reset non-readonly transaction");

            mdb_txn_reset(_handle);
            State = LightningTransactionState.Reseted;
        }
 private void Abort(bool environmentClosing)
 {
     try
     {
         try
         {
             this.OnClosing(environmentClosing);
         }
         finally
         {
             NativeMethods.Library.mdb_txn_abort(_handle);
         }
     }
     finally
     {
         this.DetachClosingHandler();
         this.State = LightningTransactionState.Aborted;
     }
 }
예제 #18
0
 /// <summary>
 /// Abandon all the operations of the transaction instead of saving them.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Abort()
 {
     State = LightningTransactionState.Aborted;
     StateChanging?.Invoke(State);
     Lmdb.mdb_txn_abort(_handle);
 }
예제 #19
0
 /// <summary>
 /// Abandon all the operations of the transaction instead of saving them.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Abort()
 {
     Discard(() =>
     {
         this.State = LightningTransactionState.Aborted;
         NativeMethods.Library.mdb_txn_abort(_handle);
     });
 }
예제 #20
0
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public MDBResultCode Commit()
 {
     State = LightningTransactionState.Commited;
     StateChanging?.Invoke(State);
     return(mdb_txn_commit(_handle));
 }
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call. 
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Commit()
 {
     try
     {
         try
         {
             this.OnClosing(false);
         }
         finally
         {
             try
             {
                 NativeMethods.Execute(lib => lib.mdb_txn_commit(_handle));
             }
             catch (LightningException)
             {
                 this.Abort(false);
                 throw;
             }
             this.State = LightningTransactionState.Commited;
         }
     }
     finally
     {
         this.DetachClosingHandler();
     }            
 }