private CreateTransaction ( ) : |
||
return |
public void Write(Action <StorageActionsAccessor> func) { lock (locker) { using (var reader = OpenReader()) { var mutator = new StorageMutator(writer, reader, transaction); var viewer = new StorageReader(reader, transaction); var accessor = new StorageActionsAccessor(mutator, viewer, reader, writer); func(accessor); mutator.Flush(); var storageTransaction = mutator.CreateTransaction(); if (transaction.Equals(storageTransaction)) { return; } WriteTransaction(storageTransaction); writer.Flush(true); transaction = storageTransaction; accessor.RaiseCommitEvent(); if (onCommit != null) { onCommit(); } } } }
public void Write(Action<StorageActionsAccessor> func) { lock (locker) { using (var reader = OpenReader()) { var mutator = new StorageMutator(writer, reader, transaction); var viewer = new StorageReader(reader, transaction); var accessor = new StorageActionsAccessor(mutator, viewer, reader, writer); func(accessor); mutator.Flush(); var storageTransaction = mutator.CreateTransaction(); if (transaction.Equals(storageTransaction)) return; WriteTransaction(storageTransaction); writer.Flush(true); transaction = storageTransaction; accessor.RaiseCommitEvent(); if (onCommit != null) onCommit(); } } }