private async Task WriteBlockUnderTransaction(IBSManager bsManager, ulong OffsetToWriteFrom, ulong bytesToWrite, uint iCopyFromIndex, byte[] arrPayload) { SFBlockstoreService service = (SFBlockstoreService)bsManager; using (var tx = service.StateManager.CreateTransaction()) { await bsManager.WriteBlock(tx, DeviceID, OffsetToRW, OffsetToWriteFrom, (uint)bytesToWrite, arrPayload, iCopyFromIndex); // If an exception is thrown before calling CommitAsync, the transaction aborts, all changes are // discarded, and nothing is saved to the secondary replicas. await tx.CommitAsync(); } }
public SFBlockStoreCommunicationListener(StatefulServiceContext context, SFBlockstoreService service) { this.context = context; this.serviceBlockStore = service; }