public Task<AllEventsSlice> ReadAllEventsForwardAsync(Position position, int maxCount, bool resolveLinkTos, UserCredentials userCredentials = null)
 {
     Ensure.Positive(maxCount, "maxCount");
     if (maxCount > Consts.MaxReadSize) throw new ArgumentException(string.Format("Count should be less than {0}. For larger reads you should page.", Consts.MaxReadSize));
     var source = new TaskCompletionSource<AllEventsSlice>();
     var operation = new ReadAllEventsForwardOperation(Settings.Log, source, position, maxCount,
                                                       resolveLinkTos, Settings.RequireMaster, userCredentials);
     EnqueueOperation(operation);
     return source.Task;
 }
        public Task <AllEventsSlice> ReadAllEventsForwardAsync(Position position, int maxCount, bool resolveLinkTos, UserCredentials userCredentials = null)
        {
            Ensure.Positive(maxCount, "maxCount");

            var source    = new TaskCompletionSource <AllEventsSlice>();
            var operation = new ReadAllEventsForwardOperation(_settings.Log, source, position, maxCount,
                                                              resolveLinkTos, _settings.RequireMaster, userCredentials);

            EnqueueOperation(operation);
            return(source.Task);
        }
Ejemplo n.º 3
0
        public Task <AllEventsSlice> ReadAllEventsForwardAsync(Position position, int maxCount)
        {
            Ensure.NotNull(position, "position");
            Ensure.Positive(maxCount, "maxCount");

            var source    = new TaskCompletionSource <AllEventsSlice>();
            var operation = new ReadAllEventsForwardOperation(source, Guid.NewGuid(), position, maxCount, true);

            EnqueueOperation(operation);
            return(source.Task);
        }
        public async Task <AllEventsSlice> ReadAllEventsForwardAsync(Position position, int maxCount, bool resolveLinkTos, UserCredentials userCredentials = null)
        {
            Ensure.Positive(maxCount, "maxCount");
            if (maxCount > ClientApiConstants.MaxReadSize)
            {
                throw new ArgumentException(string.Format("Count should be less than {0}. For larger reads you should page.", ClientApiConstants.MaxReadSize));
            }
            var source    = new TaskCompletionSource <AllEventsSlice>(TaskCreationOptions.RunContinuationsAsynchronously);
            var operation = new ReadAllEventsForwardOperation(Settings.Log, source, position, maxCount,
                                                              resolveLinkTos, Settings.RequireMaster, userCredentials);

            await EnqueueOperation(operation).ConfigureAwait(false);

            return(await source.Task.ConfigureAwait(false));
        }