public Task <IChunk> ReadByOperationIdAsync(string partitionId, string operationId,
                                             CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.ReadByOperationId, () =>
                          _persistence.ReadByOperationIdAsync(partitionId, operationId, cancellationToken)
                          ));
 }
 public Task ReadAllByOperationIdAsync(string operationId, ISubscription subscription,
                                       CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.ReadAllByOperationId, () =>
                          _persistence.ReadAllByOperationIdAsync(operationId, subscription, cancellationToken)
                          ));
 }
 public Task <IChunk> AppendAsync(string partitionId, long index, object payload, string operationId,
                                  CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.Append, () =>
                          _persistence.AppendAsync(partitionId, index, payload, operationId, cancellationToken)
                          ));
 }
 public Task ReadAllAsync(long fromPositionInclusive, ISubscription subscription, int limit,
                          CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.ReadAll, () =>
                          _persistence.ReadAllAsync(fromPositionInclusive, subscription, limit, cancellationToken)
                          ));
 }
 public Task <IChunk> ReadSingleBackwardAsync(string partitionId, long fromUpperIndexInclusive,
                                              CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.ReadSingleBackward, () =>
                          _persistence.ReadSingleBackwardAsync(partitionId, fromUpperIndexInclusive, cancellationToken)
                          ));
 }
 public Task DeleteAsync(string partitionId, long fromLowerIndexInclusive, long toUpperIndexInclusive,
                         CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.Delete, () =>
                          _persistence.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive,
                                                   cancellationToken)
                          ));
 }
 public Task ReadBackwardAsync(string partitionId, long fromUpperIndexInclusive, ISubscription subscription,
                               long toLowerIndexInclusive, int limit, CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.ReadBackward, () =>
                          _persistence.ReadBackwardAsync(partitionId, fromUpperIndexInclusive, subscription,
                                                         toLowerIndexInclusive, limit, cancellationToken)
                          ));
 }
Example #8
0
 protected override async Task ProcessAsync(Signal payload)
 {
     Track.Inc(Counters.ReceivedMessages);
     await Track.Profile(Timers.RequestTimer, async() =>
     {
         while (true)
         {
             try
             {
                 await _persistence.AppendAsync(
                     payload.DeviceId,
                     DateTime.UtcNow.Ticks,
                     payload
                     ).ConfigureAwait(false);
                 return;
             }
             catch (DuplicateStreamIndexException)
             {
                 // retry with new ticks
             }
         }
     }).ConfigureAwait(false);
 }
 public Task <long> ReadLastPositionAsync(CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.ReadLastPosition, () =>
                          _persistence.ReadLastPositionAsync(cancellationToken)
                          ));
 }