コード例 #1
0
        private EventStreamCursor(EventStreamHeader streamHeader, StreamVersion fromVersion, FetchEvents fetch)
        {
            Require.NotNull(fetch, "fetch");

            m_state = new InitialCursorState(streamHeader, fromVersion, fetch);
            m_slice = EventStreamSlice.Empty;
            m_cursorStreamVersion = fromVersion;
        }
コード例 #2
0
        public EventStreamCursor(EventStreamPosition position, StreamVersion fromVersion, FetchEvents fetch)
        {
            Require.NotNull(fetch, "fetch");

            if (EventStreamPosition.IsNewStream(position))
            {
                m_state = new EndOfStreamCursorState();
                m_slice = EventStreamSlice.Empty;
            }
            else
            {
                m_state = new InitialCursorState(position, fromVersion, fetch);
            }
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public async Task FetchSlice()
 {
     m_slice = await m_state.FetchSlice();
     m_state = m_state.NextState;
 }
コード例 #6
0
        public async Task FetchSlice()
        {
            m_slice = await m_state.FetchSlice();

            m_state = m_state.NextState;
        }
コード例 #7
0
 private EventStreamCursor()
 {
     m_state = new EndOfStreamCursorState(EventStreamHeader.Unknown);
     m_slice = EventStreamSlice.Empty;
 }
コード例 #8
0
 private EventStreamCursor(EventStreamHeader streamHeader, StreamVersion fromVersion)
 {
     m_state = new EndOfStreamCursorState(streamHeader);
     m_slice = EventStreamSlice.Empty;
     m_cursorStreamVersion = fromVersion;
 }