Пример #1
0
 public void ConfigurePollingFunction(string bucketId = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (bucketId == null)
     {
         _pollingFunc = () => _persistStreams.GetFromAsync(_checkpointToken, cancellationToken);
     }
     else
     {
         _pollingFunc = () => _persistStreams.GetFromAsync(bucketId, _checkpointToken, cancellationToken);
     }
 }
        /// <summary>
        /// Gets all commits after from start checkpoint.
        /// </summary>
        /// <param name="persistStreams">The IPersistStreams instance.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        public static Task <IEnumerable <ICommit> > GetFromStartAsync(this IPersistStreams persistStreams, CancellationToken cancellationToken)
        {
            if (persistStreams == null)
            {
                throw new ArgumentNullException(nameof(persistStreams));
            }

            return(persistStreams.GetFromAsync(0, cancellationToken));
        }
        public virtual Task <IEnumerable <ICommit> > GetFromAsync(string bucketId, string streamId, int minRevision, int maxRevision, CancellationToken cancellationToken)
        {
            //var result = new List<ICommit>();
            //foreach (var commit in await _persistence
            //    .GetFromAsync(bucketId, streamId, minRevision, maxRevision, cancellationToken)
            //    .ConfigureAwait(false))
            //{
            //    var filtered = commit;
            //    foreach (var hook in _pipelineHooks)
            //    {
            //        cancellationToken.ThrowIfCancellationRequested();

            //        filtered = await hook
            //            .SelectAsync(filtered, cancellationToken)
            //            .ConfigureAwait(false);

            //        if (filtered == null)
            //        {
            //            Logger.Info(Resources.PipelineHookSkippedCommit, hook.GetType(), commit.CommitId);
            //            break;
            //        }
            //    }

            //    cancellationToken.ThrowIfCancellationRequested();

            //    if (filtered == null)
            //    {
            //        Logger.Info(Resources.PipelineHookFilteredCommit);
            //    }
            //    else
            //    {
            //        result.Add(filtered);
            //    }
            //}

            //return result;
            return(_persistence.GetFromAsync(bucketId, streamId, minRevision, maxRevision, cancellationToken));
        }
 public Task <IEnumerable <ICommit> > GetFromAsync(string bucketId, string streamId, int minRevision, int maxRevision, CancellationToken cancellationToken)
 {
     return(_persistence.GetFromAsync(bucketId, streamId, minRevision, maxRevision, cancellationToken));
 }