Пример #1
0
 public Transaction(ServerCore core, Guid transactionId)
 {
     _core      = core;
     IsImplicit = false;
     Id         = transactionId;
     DeferredIO = new DeferredIO(core);
 }
Пример #2
0
        /// <summary>
        /// Decreases the transaction reference count. If it falls to zero, the transaction is comitted.
        /// </summary>
        /// <returns></returns>
        public bool Commit()
        {
            _references--;

            if (_references < 0)
            {
                throw new Exception("Transaction reference count fell below zero.");
            }

            if (_references == 0)
            {
                _latchKeys.TurnInAllKeys();

                if (Directory.Exists(TransactionBackupPath))
                {
                    Directory.Delete(TransactionBackupPath, true);
                }

                DeferredIO.Commit();

                return(true);
            }

            return(false);
        }
Пример #3
0
 public Transaction(ServerCore core, Session session, bool isImplicit)
 {
     _core      = core;
     IsImplicit = isImplicit;
     _session   = session;
     Id         = Guid.NewGuid();
     DeferredIO = new DeferredIO(core);
 }