internal virtual void SuspendSinceTransactionsAreStillThreadBound() { Debug.Assert(_suspendedTransaction == null, "Can't suspend the transaction if it already is suspended."); _suspendedTransaction = _bridge.getKernelTransactionBoundToThisThread(true); _bridge.unbindTransactionFromCurrentThread(); }
internal virtual void ResumeSinceTransactionsAreStillThreadBound() { Debug.Assert(_suspendedTransaction != null, "Can't resume the transaction if it has not first been suspended."); _bridge.bindTransactionToCurrentThread(_suspendedTransaction); _suspendedTransaction = null; }
public PlaceboTransaction(KernelTransaction currentTransaction) { this._currentTransaction = currentTransaction; }
public void Commit() { object sync = this.sync; lock (sync) { switch (this.state) { case SaveTransactionState.Initializing: case SaveTransactionState.FailedInitialization: case SaveTransactionState.Committing: case SaveTransactionState.FailedCommit: case SaveTransactionState.Committed: case SaveTransactionState.RollingBack: case SaveTransactionState.FailedRollback: case SaveTransactionState.RolledBack: throw new InvalidOperationException($"This transaction is not in a state that allows it to be committed ({this.state})"); case SaveTransactionState.Initialized: break; case SaveTransactionState.Disposed: throw new ObjectDisposedException("SaveTransaction"); default: throw new InternalErrorException(new InvalidEnumArgumentException("this.state", (int)this.state, typeof(SaveTransactionState))); } this.state = SaveTransactionState.Committing; try { DisposableUtil.Free <GuardedStream>(ref this.guardedStream); if (this.kernelTx != null) { this.kernelTx.Commit(); this.kernelTx = null; this.tempPath = null; } else { string destFileName = FindUniqueFileName(this.path + ".", ".pdnBak"); bool flag2 = File.Exists(this.path); if (flag2) { File.Move(this.path, destFileName); } File.Move(this.tempPath, this.path); this.tempPath = null; if (flag2) { File.Delete(destFileName); } } this.state = SaveTransactionState.Committed; } catch (Exception) { this.state = SaveTransactionState.FailedCommit; throw; } } }
public TestKernelTransactionHandle(KernelTransaction tx) { this._tx = Objects.requireNonNull(tx); }
public override bool IsUnderlyingTransaction(KernelTransaction tx) { return(this._tx == tx); }
public override void BindTransactionToCurrentThread(KernelTransaction tx) { _txBridge.bindTransactionToCurrentThread(tx); }
internal DelegatingTransaction(KernelTransaction @internal, Locks locks) { this.Internal = @internal; this.LocksConflict = locks; }
public virtual TransactionHooksState BeforeCommit(ReadableTransactionState state, KernelTransaction tx, StorageReader storageReader) { if (Hooks.Count == 0) { return(null); } TransactionHooksState hookState = new TransactionHooksState(); foreach (TransactionHook hook in Hooks) { TransactionHook_Outcome outcome = hook.beforeCommit(state, tx, storageReader); hookState.Add(hook, outcome); } return(hookState); }