Пример #1
0
        /// <summary>
        /// Commits should be ordered ascending by commit date
        /// </summary>

        /// <returns></returns>
        public Optional <Commit> GetNextCommit()
        {
start:
            if (_commits == null)
            {
                EventStore.Logger.Debug($"Getting next batch of '{_config.Name}'");
                _commits = _store.GetNextBatch(_config, _processed);
            }
            if (_commits.IsEmpty)
            {
                EventStore.Logger.Debug($"No more batches for '{_config.Name}'");
                _hasEnded = true;
                return(Optional <Commit> .Empty);
            }

            var next = _commits.GetNext();

            if (next.IsEmpty)
            {
                _commits = null;
                goto start;
            }
            _processed++;
            EventStore.Logger.Debug($"{_processed.Value} commits processed as part of '{_config.Name}'");
            return(next);
        }
Пример #2
0
 private void NoCommitsStoreSetup()
 {
     _store.GetNextBatch(Arg.Any <ReadModelGenerationConfig>(), Arg.Any <ProcessedCommitsCount>())
     .Returns(new CommittedEvents(new Commit[0]));
 }