Exemplo n.º 1
0
 public Task <bool> Append(IFullyEvent <PrimaryKey> fullyEvent, EventBytesTransport bytesTransport, string unique)
 {
     return(Task.Run(async() =>
     {
         var wrap = new DataAsyncWrapper <BatchAppendTransport <PrimaryKey>, bool>(new BatchAppendTransport <PrimaryKey>(fullyEvent, bytesTransport, unique));
         var writeTask = mpscChannel.WriteAsync(wrap);
         if (!writeTask.IsCompletedSuccessfully)
         {
             await writeTask;
         }
         return await wrap.TaskSource.Task;
     }));
 }
Exemplo n.º 2
0
 public Task <bool> Append(SaveTransport <PrimaryKey> saveTransport)
 {
     return(Task.Run(async() =>
     {
         var wrap = new DataAsyncWrapper <SaveTransport <PrimaryKey>, bool>(saveTransport);
         var writeTask = mpscChannel.WriteAsync(wrap);
         if (!writeTask.IsCompletedSuccessfully)
         {
             await writeTask;
         }
         return await wrap.TaskSource.Task;
     }));
 }
Exemplo n.º 3
0
 public Task <bool> Append <Input>(string unitName, Commit <Input> commit)
 {
     return(Task.Run(async() =>
     {
         var wrap = new DataAsyncWrapper <AppendInput, bool>(new AppendInput
         {
             UnitName = unitName,
             TransactionId = commit.TransactionId,
             Data = serializer.SerializeToString(commit.Data),
             Status = commit.Status
         });
         var writeTask = mpscChannel.WriteAsync(wrap);
         if (!writeTask.IsCompletedSuccessfully)
         {
             await writeTask;
         }
         return await wrap.TaskSource.Task;
     }));
 }