public EsentInFlightTransactionalState(TransactionalStorage storage, CommitTransactionGrbit txMode, Func <string, Etag, RavenJObject, RavenJObject, TransactionInformation, PutResult> databasePut, Func <string, Etag, TransactionInformation, bool> databaseDelete) : base(databasePut, databaseDelete) { this.storage = storage; this.txMode = txMode; timer = new Timer(CleanupOldTransactions, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); }
/// <summary> /// Commit a transaction. This object must be in a transaction. /// </summary> /// <param name="options"> /// Transaction commit options. /// </param> public override void Commit(CommitOptions options) { this.CheckNotDisposed(); if (!this.inTransaction) { throw new InvalidOperationException("Not in a transaction"); } if (null != this.subTransaction) { this.Tracer.TraceWarning("committing subtransaction"); // subTransaction.Commit() raises the Committed event which will // call UnregisterSubTransaction. this.subTransaction.Commit(); } if (null != this.Committed) { this.Committed(); } CommitTransactionGrbit grbit = Transaction.GrbitFromOptions(options); Api.JetCommitTransaction(this.session, grbit); // Even if this transaction commits the work done in the transaction will // be undone if the outer transaction is rolled back. To make sure that the // correct events are sent we transfer our rollback delegates to the outer // transaction. this.TransferRollbackDelegatesToOuterTransaction(); this.inTransaction = false; this.Tracer.TraceVerbose("commit ({0})", grbit); }
public EsentInFlightTransactionalState(TransactionalStorage storage, CommitTransactionGrbit txMode, Func<string, Etag, RavenJObject, RavenJObject, TransactionInformation, PutResult> databasePut, Func<string, Etag, TransactionInformation, bool> databaseDelete) : base(databasePut, databaseDelete) { this.storage = storage; this.txMode = txMode; timer = new Timer(CleanupOldTransactions, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); }
/// <summary> /// Commits the changes made to the state of the database during the current save point /// and migrates them to the previous save point. If the outermost save point is committed /// then the changes made during that save point will be committed to the state of the /// database and the session will exit the transaction. /// </summary> /// <param name="sesid">The session to commit the transaction for.</param> /// <param name="grbit">Commit options.</param> /// <param name="durableCommit">Duration to commit lazy transaction.</param> /// <param name="commitId">Commit-id associated with this commit record.</param> public static void JetCommitTransaction2( JET_SESID sesid, CommitTransactionGrbit grbit, TimeSpan durableCommit, out JET_COMMIT_ID commitId) { Api.Check(Api.Impl.JetCommitTransaction2(sesid, grbit, durableCommit, out commitId)); }
public EsentInFlightTransactionalState(DocumentDatabase database, TransactionalStorage storage, CommitTransactionGrbit txMode, Func <string, Etag, RavenJObject, RavenJObject, TransactionInformation, PutResult> databasePut, Func <string, Etag, TransactionInformation, bool> databaseDelete) : base(databasePut, databaseDelete, database.StartupTasks.OfType <ReplicationTask>().FirstOrDefault() != null) { _database = database; this.storage = storage; this.txMode = txMode; timer = database.TimerManager.NewTimer(CleanupOldTransactions, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30)); }
/// <summary> /// Commits the changes made to the state of the database during the current save point /// and migrates them to the previous save point. If the outermost save point is committed /// then the changes made during that save point will be committed to the state of the /// database and the session will exit the transaction. /// </summary> /// <param name="sesid">The session to commit the transaction for.</param> /// <param name="grbit">Commit options.</param> /// <param name="durableCommit">Duration to commit lazy transaction.</param> /// <param name="commitId">Commit-id associated with this commit record.</param> public static void JetCommitTransaction2( JET_SESID sesid, CommitTransactionGrbit grbit, TimeSpan durableCommit, out JET_COMMIT_ID commitId) { Api.Check(Api.Impl.JetCommitTransaction2(sesid, grbit, durableCommit, out commitId)); }
public EsentInFlightTransactionalState(DocumentDatabase database, TransactionalStorage storage, CommitTransactionGrbit txMode, Func<string, Etag, RavenJObject, RavenJObject, TransactionInformation, PutResult> databasePut, Func<string, Etag, TransactionInformation, bool> databaseDelete) : base(databasePut, databaseDelete) { _database = database; this.storage = storage; this.txMode = txMode; timer = database.TimerManager.NewTimer(CleanupOldTransactions, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30)); }
public Action Commit(CommitTransactionGrbit txMode) { if (transactionContext == null) { transaction.Commit(txMode); } return(OnStorageCommit); }
void Commit(CommitTransactionGrbit flags) { if (null == m_session) { throw new InvalidOperationException("Not in a transaction."); } Api.JetCommitTransaction(m_session.idSession, flags); m_session.onTransactionEnd(m_transactionLevel, true); m_session = null; m_transactionLevel = -2; }
/// <summary> /// Commit a transaction. This object should be in a transaction. /// </summary> /// <param name="grbit">JetCommitTransaction options.</param> public void Commit(CommitTransactionGrbit grbit) { this.CheckObjectIsNotDisposed(); if (!this.IsInTransaction) { throw new InvalidOperationException("Not in a transaction"); } Api.JetCommitTransaction(this.sesid, grbit); this.ResourceWasReleased(); Debug.Assert(!this.IsInTransaction, "Commit finished, but object is still in a transaction"); }
/// <summary> /// Commit a transaction. This object should be in a transaction. /// </summary> /// <param name="grbit">JetCommitTransaction options.</param> public void Commit(CommitTransactionGrbit grbit) { this.CheckObjectIsNotDisposed(); if (!this.IsInTransaction) { throw new InvalidOperationException("Not in a transaction"); } Api.JetCommitTransaction(this.sesid, grbit); this.ResourceWasReleased(); Debug.Assert(!this.IsInTransaction, "Commit finished, but object is still in a transaction"); }
/// <summary> /// Commit a transaction. This object should be in a transaction. /// </summary> /// <param name="grbit">JetCommitTransaction options.</param> /// <param name="durableCommit">Duration for committing lazy transactions.</param> /// <param name="commitId">Commit-id for this commit record.</param> public void Commit(CommitTransactionGrbit grbit, TimeSpan durableCommit, out JET_COMMIT_ID commitId) { this.CheckObjectIsNotDisposed(); if (!this.IsInTransaction) { throw new InvalidOperationException("Not in a transaction"); } Windows8.Windows8Api.JetCommitTransaction2(this.sesid, grbit, durableCommit, out commitId); this.ResourceWasReleased(); Debug.Assert(!this.IsInTransaction, "Commit finished, but object is still in a transaction"); }
/// <summary> /// Commits the current save point (level) of the current transaction /// on this session. All changes made to the database for this save /// point (level) will be kept. /// </summary> /// <param name="durableCommit"> /// When true, a commit to save point (level) zero is guaranteed to be /// persisted to the database upon completion of this method. /// </param> /// <remarks> /// <para> /// It is illegal to call this method when the session is not currently /// in a transaction. Use Session.TransactionLevel to determine the /// current transaction state of a session. /// </para> /// <para> /// A commit to save point (level) zero is guaranteed to be persisted /// to the database upon completion of this method only if /// durableCommit is true. If durableCommit is false then the changes /// will only be persisted to the database if their transaction log /// entries happen to be written to disk before a crash or if the /// database is shut down cleanly. /// </para> /// </remarks> public void CommitTransaction(bool durableCommit) { lock (this) { this.CheckDisposed(); CommitTransactionGrbit grbit = CommitTransactionGrbit.None; if (!durableCommit) { grbit |= CommitTransactionGrbit.LazyFlush; } Api.JetCommitTransaction(this.Sesid, grbit); this.transactionLevelID[--this.transactionLevel]++; } }
/// <summary> /// Commits the changes made to the state of the database during the current save point /// and migrates them to the previous save point. If the outermost save point is committed /// then the changes made during that save point will be committed to the state of the /// database and the session will exit the transaction. /// </summary> /// <param name="sesid">The session to commit the transaction for.</param> /// <param name="grbit">Commit options.</param> /// <param name="durableCommit">Duration to commit lazy transaction.</param> /// <param name="commitId">Commit-id associated with this commit record.</param> /// <returns>An error if the call fails.</returns> public int JetCommitTransaction2(JET_SESID sesid, CommitTransactionGrbit grbit, TimeSpan durableCommit, out JET_COMMIT_ID commitId) { TraceFunctionCall("JetCommitTransaction2"); this.CheckSupportsWindows8Features("JetCommitTransaction2"); int err; uint cmsecDurableCommit = (uint)durableCommit.TotalMilliseconds; NATIVE_COMMIT_ID nativeCommitId = new NATIVE_COMMIT_ID(); unsafe { err = Err(NativeMethods.JetCommitTransaction2(sesid.Value, unchecked((uint)grbit), cmsecDurableCommit, ref nativeCommitId)); } commitId = new JET_COMMIT_ID(nativeCommitId); return err; }
/// <summary> /// Commits the changes made to the state of the database during the current save point /// and migrates them to the previous save point. If the outermost save point is committed /// then the changes made during that save point will be committed to the state of the /// database and the session will exit the transaction. /// </summary> /// <param name="sesid">The session to commit the transaction for.</param> /// <param name="grbit">Commit options.</param> /// <param name="durableCommit">Duration to commit lazy transaction.</param> /// <param name="commitId">Commit-id associated with this commit record.</param> /// <returns>An error if the call fails.</returns> public int JetCommitTransaction2(JET_SESID sesid, CommitTransactionGrbit grbit, TimeSpan durableCommit, out JET_COMMIT_ID commitId) { TraceFunctionCall(); this.CheckSupportsWindows8Features("JetCommitTransaction2"); int err; uint cmsecDurableCommit = (uint)durableCommit.TotalMilliseconds; NATIVE_COMMIT_ID nativeCommitId = new NATIVE_COMMIT_ID(); unsafe { err = Err(NativeMethods.JetCommitTransaction2(sesid.Value, unchecked ((uint)grbit), cmsecDurableCommit, ref nativeCommitId)); } commitId = new JET_COMMIT_ID(nativeCommitId); return(err); }
public Action Commit(CommitTransactionGrbit txMode) { transaction.Commit(txMode); return OnCommit; }
public Action Commit(CommitTransactionGrbit txMode) { transaction.Commit(txMode); return(OnCommit); }
public void Commit(CommitTransactionGrbit txMode) { transaction.Commit(txMode); OnCommit(); }
public ValueTask <Nothing> RunInTransaction(Func <bool> logic, double?retrySec = null, CommitTransactionGrbit grbit = CommitTransactionGrbit.None) { if (logic == null) { return(new ValueTask <Nothing>(Nothing.Value)); } return(RunInTransaction(() => { var isCommit = logic(); return (isCommit, Nothing.Value); }, retrySec, grbit)); }
public void Commit(CommitTransactionGrbit txMode) { transaction.Commit(txMode); OnCommit(); }
public void Pulse(CommitTransactionGrbit grbit) { Transaction.Commit(grbit); Transaction = new Transaction(JetSesid); }
public Action Commit(CommitTransactionGrbit txMode) { if (transactionContext == null) { transaction.Commit(txMode); } return OnStorageCommit; }
public Action Commit(CommitTransactionGrbit txMode) { if (txMode == CommitTransactionGrbit.WaitLastLevel0Commit) transaction.Commit(CommitTransactionGrbit.LazyFlush); transaction.Commit(txMode); return OnStorageCommit; }
/// <summary> /// Commit a transaction. This object should be in a transaction. /// </summary> /// <param name="grbit">JetCommitTransaction options.</param> /// <param name="durableCommit">Duration for committing lazy transactions.</param> /// <param name="commitId">Commit-id for this commit record.</param> public void Commit(CommitTransactionGrbit grbit, TimeSpan durableCommit, out JET_COMMIT_ID commitId) { this.CheckObjectIsNotDisposed(); if (!this.IsInTransaction) { throw new InvalidOperationException("Not in a transaction"); } Windows8.Windows8Api.JetCommitTransaction2(this.sesid, grbit, durableCommit, out commitId); this.ResourceWasReleased(); Debug.Assert(!this.IsInTransaction, "Commit finished, but object is still in a transaction"); }
/// <inheritdoc /> public void Commit(CommitTransactionGrbit flags = CommitTransactionGrbit.LazyFlush) { Internal.InternalTransaction.Commit(flags); }
public void Commit(CommitTransactionGrbit grbit) { Transaction.Commit(grbit); }
/// <summary> /// Commits the changes made to the state of the database during the current save point /// and migrates them to the previous save point. If the outermost save point is committed /// then the changes made during that save point will be committed to the state of the /// database and the session will exit the transaction. /// </summary> /// <param name="sesid">The session to commit the transaction for.</param> /// <param name="grbit">Commit options.</param> public static void JetCommitTransaction(JET_SESID sesid, CommitTransactionGrbit grbit) { Api.Check(Impl.JetCommitTransaction(sesid, grbit)); }