//[DebuggerHidden, DebuggerNonUserCode, DebuggerStepThrough] private Action ExecuteBatch(Action <IStorageActionsAccessor> action, EsentTransactionContext transactionContext) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; bool lockTaken = false; if (transactionContext != null) { Monitor.Enter(transactionContext, ref lockTaken); } try { using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, transactionContext, this)) { var dtcSnapshot = inFlightTransactionalState != null? // might be not already initialized yet, during database creation inFlightTransactionalState.GetSnapshot() : EmptyInFlightStateSnapshot.Instance; var storageActionsAccessor = new StorageActionsAccessor(pht, dtcSnapshot); if (disableBatchNesting.Value == null) { current.Value = storageActionsAccessor; } action(storageActionsAccessor); storageActionsAccessor.SaveAllTasks(); pht.ExecuteBeforeStorageCommit(); if (pht.UsingLazyCommit) { txMode = CommitTransactionGrbit.None; } try { return(pht.Commit(txMode)); } finally { pht.ExecuteAfterStorageCommit(); } } } finally { if (lockTaken) { Monitor.Exit(transactionContext); } } }
private void ExecuteBatch(Action <IStorageActionsAccessor> action) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher)) { current.Value = new StorageActionsAccessor(pht); action(current.Value); pht.Commit(txMode); } }
private void ExecuteBatch(Action <DocumentStorageActions> action) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs)) { current.Value = pht; action(pht); pht.Commit(txMode); onCommit(); } }
private Action ExecuteBatch(Action <IStorageActionsAccessor> action) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, this)) { var storageActionsAccessor = new StorageActionsAccessor(pht); current.Value = storageActionsAccessor; action(current.Value); storageActionsAccessor.SaveAllTasks(); return(pht.Commit(txMode)); } }
//[DebuggerHidden, DebuggerNonUserCode, DebuggerStepThrough] private Action ExecuteBatch(Action <IStorageActionsAccessor> action, EsentTransactionContext transactionContext) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; bool lockTaken = false; if (transactionContext != null) { Monitor.Enter(transactionContext, ref lockTaken); } try { using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, transactionContext, this)) { var storageActionsAccessor = new StorageActionsAccessor(pht); if (disableBatchNesting.Value == null) { current.Value = storageActionsAccessor; } action(storageActionsAccessor); storageActionsAccessor.SaveAllTasks(); if (pht.UsingLazyCommit) { txMode = CommitTransactionGrbit.None; } return(pht.Commit(txMode)); } } finally { if (lockTaken) { Monitor.Exit(transactionContext); } } }
private void ExecuteBatch(Action<IStorageActionsAccessor> action) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, this)) { var storageActionsAccessor = new StorageActionsAccessor(pht); current.Value = storageActionsAccessor; action(current.Value); storageActionsAccessor.SaveAllTasks(); pht.Commit(txMode); } }
//[DebuggerHidden, DebuggerNonUserCode, DebuggerStepThrough] private Action ExecuteBatch(Action<IStorageActionsAccessor> action, EsentTransactionContext transactionContext) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; bool lockTaken = false; if (transactionContext != null) Monitor.Enter(transactionContext, ref lockTaken); try { using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, transactionContext, this)) { var storageActionsAccessor = new StorageActionsAccessor(pht); if (disableBatchNesting.Value == null) current.Value = storageActionsAccessor; action(storageActionsAccessor); storageActionsAccessor.SaveAllTasks(); pht.ExecuteBeforeStorageCommit(); if (pht.UsingLazyCommit) txMode = CommitTransactionGrbit.None; try { return pht.Commit(txMode); } finally { pht.ExecuteAfterStorageCommit(); } } } finally { if (lockTaken) Monitor.Exit(transactionContext); } }
private void ExecuteBatch(Action<DocumentStorageActions> action) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs)) { current.Value = pht; action(pht); pht.Commit(txMode); onCommit(); } }
private Action ExecuteBatch(Action<IStorageActionsAccessor> action) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, this)) { var storageActionsAccessor = new StorageActionsAccessor(pht); current.Value = storageActionsAccessor; action(current.Value); storageActionsAccessor.SaveAllTasks(); pht.FlushMapReduceUpdates(); if (pht.UsingLazyCommit) { txMode = CommitTransactionGrbit.WaitLastLevel0Commit; } return pht.Commit(txMode); } }
//[DebuggerHidden, DebuggerNonUserCode, DebuggerStepThrough] private Action ExecuteBatch(Action<IStorageActionsAccessor> action, EsentTransactionContext transactionContext) { var txMode = configuration.TransactionMode == TransactionMode.Lazy ? CommitTransactionGrbit.LazyFlush : CommitTransactionGrbit.None; using (var pht = new DocumentStorageActions(instance, database, tableColumnsCache, DocumentCodecs, generator, documentCacher, transactionContext, this)) { var storageActionsAccessor = new StorageActionsAccessor(pht); if(disableBatchNesting.Value == null) current.Value = storageActionsAccessor; action(storageActionsAccessor); storageActionsAccessor.SaveAllTasks(); if (pht.UsingLazyCommit) { txMode = CommitTransactionGrbit.None; } return pht.Commit(txMode); } }