Beispiel #1
0
        public Task <EventStreamHeader> AppendEventsAsync(
            string streamName,
            EventStreamHeader header,
            IReadOnlyCollection <JournaledEvent> events)
        {
            Require.NotEmpty(streamName, "streamName");
            Require.NotEmpty(events, "events");

            var operation = m_table.CreateAppendOperation(streamName, header);

            operation.Prepare(events);

            return(ExecuteOperationAsync(operation));
        }
Beispiel #2
0
        public async Task <IEventStreamCursor> OpenEventStreamCursorAsync(string streamName, int sliceSize)
        {
            Require.NotEmpty(streamName, "streamName");
            Require.Positive(sliceSize, "sliceSize");

            var header = await ReadStreamHeaderAsync(streamName);

            if (EventStreamHeader.IsNewStream(header))
            {
                return(EventStreamCursor.UninitializedStream);
            }

            return(EventStreamCursor.CreateActiveCursor(
                       header,
                       StreamVersion.Start,
                       from => m_table.FetchStreamEvents(streamName, header, from, sliceSize)));
        }