public Task <long> ReplicateAtomicGroupOperationAsync(long atomicGroupId, OperationData operationData, CancellationToken cancellationToken, out long sequenceNumber)
        {
            Requires.Argument("operationData", operationData).NotNull();
            long sequenceNumberOut = 0;

            var returnValue = Utility.WrapNativeAsyncInvoke <long>(
                (callback) =>
            {
                NativeCommon.IFabricAsyncOperationContext context;
                sequenceNumberOut = this.ReplicateBeginWrapper(atomicGroupId, operationData, callback, out context);
                return(context);
            },
                this.ReplicateEndWrapper,
                cancellationToken,
                "AtomicGroupStateReplicator.ReplicateAtomicGroupOperation");

            sequenceNumber = sequenceNumberOut;

            return(returnValue);
        }
        public Task <long> ReplicateAsync(OperationData operationData, CancellationToken cancellationToken, out long sequenceNumber)
        {
            Requires.Argument("operationData", operationData).NotNull();
            long sequenceNumberOut = 0;
            var  returnValue       = Utility.WrapNativeAsyncInvoke <long>(
                (callback) =>
            {
                NativeCommon.IFabricAsyncOperationContext context;
                sequenceNumberOut = this.ReplicateBeginWrapper(operationData, callback, out context);
                return(context);
            },
                this.ReplicateEndWrapper,
                InteropExceptionTracePolicy.None,
                cancellationToken,
                "StateReplicator.ReplicateAsync");

            // assign out variable
            sequenceNumber = sequenceNumberOut;
            return(returnValue);
        }
            public NativeRuntime.IFabricOperationData EndGetNext(NativeCommon.IFabricAsyncOperationContext context)
            {
                OperationData buffers = AsyncTaskCallInAdapter.End <OperationData>(context);

                return(this.operationDataFactory.CreateOperationData(buffers));
            }
 private OperationData GetNextEndWrapper(NativeCommon.IFabricAsyncOperationContext context)
 {
     NativeRuntime.IFabricOperationData comData = this.enumerator.EndGetNext(context);
     return(comData == null ? null : OperationData.CreateFromNative(comData));
 }