public Task<AllEventsPage> ReadAll(
     Checkpoint checkpoint,
     int maxCount,
     ReadDirection direction = ReadDirection.Forward,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return _inner.ReadAll(checkpoint, maxCount, direction, cancellationToken);
 }
 public Task<AllEventsPage> ReadAll(
     Checkpoint checkpoint,
     int maxCount,
     ReadDirection direction = ReadDirection.Forward,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
示例#3
0
         public async Task<AllEventsPage> ReadAll(
             Checkpoint checkpoint,
             int maxCount,
             ReadDirection direction = ReadDirection.Forward,
             CancellationToken cancellationToken = default(CancellationToken))
         {
             Ensure.That(checkpoint, "checkpoint").IsNotNull();

             var connection = _getConnection();

             var position = checkpoint.ParsePosition();

             AllEventsSlice allEventsSlice;
             if (direction == ReadDirection.Forward)
             {
                 allEventsSlice = await connection
                     .ReadAllEventsForwardAsync(position, maxCount, resolveLinkTos: false)
                     .NotOnCapturedContext();
             }
             else
             {
                 allEventsSlice = await connection
                     .ReadAllEventsBackwardAsync(position, maxCount, resolveLinkTos: false)
                     .NotOnCapturedContext();
             }

             var events = allEventsSlice
                 .Events
                 .Where(@event => 
                     !(@event.OriginalEvent.EventType.StartsWith("$") 
                     || @event.OriginalStreamId.StartsWith("$")))
                 .Select(resolvedEvent =>resolvedEvent.ToSteamEvent())
                 .ToArray();

             return new AllEventsPage(
                 allEventsSlice.FromPosition.ToString(),
                 allEventsSlice.NextPosition.ToString(),
                 allEventsSlice.IsEndOfStream,
                 GetReadDirection(allEventsSlice.ReadDirection),
                 events);
         }
        public async Task<AllEventsPage> ReadAll(
            Checkpoint checkpoint,
            int maxCount,
            ReadDirection direction = ReadDirection.Forward,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.That(checkpoint, "checkpoint").IsNotNull();
            CheckIfDisposed();

            var connection = _getConnection();

            var position = checkpoint.ParsePosition();

            AllEventsSlice allEventsSlice;
            if(direction == ReadDirection.Forward)
            {
                allEventsSlice = await connection
                    .ReadAllEventsForwardAsync(position, maxCount, resolveLinkTos: false)
                    .NotOnCapturedContext();
            }
            else
            {
                allEventsSlice = await connection
                    .ReadAllEventsBackwardAsync(position, maxCount, resolveLinkTos: false)
                    .NotOnCapturedContext();
            }

            var events = allEventsSlice
                .Events
                .Where(@event =>
                    !(@event.OriginalEvent.EventType.StartsWith("$")
                      || @event.OriginalStreamId.StartsWith("$")))
                .Select(resolvedEvent => resolvedEvent.ToSteamEvent())
                .ToArray();

            return new AllEventsPage(
                allEventsSlice.FromPosition.ToString(),
                allEventsSlice.NextPosition.ToString(),
                allEventsSlice.IsEndOfStream,
                GetReadDirection(allEventsSlice.ReadDirection),
                events);
        }