public override async Task<EventStreamSlice> FetchSlice() { var slice = new EventStreamSlice(m_position, await m_fetch(m_currentSlicePosition.Version.Increment(1))); if (slice.EndOfStream) { NextState = new EndOfStreamCursorState(); } else { NextState = new FetchingCursorState(m_position, slice.SlicePosition, m_fetch); } return slice; }
public override async Task <EventStreamSlice> FetchSlice() { var fetchResult = await m_fetch(m_version); var slice = new EventStreamSlice(fetchResult.Events); if (fetchResult.IsFetchingCompleted) { NextState = new EndOfStreamCursorState(StreamHeader); } else { NextState = new FetchingCursorState(StreamHeader, slice.ToStreamVersion.Increment(), m_fetch); } return(slice); }