public static async Task <AllPartitionsRecorder> GetAllEvents(this IPersistence persistence) { var tape = new AllPartitionsRecorder(); await persistence.ReadAllAsync(0, tape).ConfigureAwait(false); return(tape); }
public static async Task <AllPartitionsRecorder> GetAllEventForAPartition(this IPersistence persistence, String partitionId) { var tape = new AllPartitionsRecorder(); await persistence.ReadForwardAsync(partitionId, tape).ConfigureAwait(false); return(tape); }
public async Task read_all_forward_from_middle_limit_one() { var tape = new AllPartitionsRecorder(); await Store.ReadAllAsync(3, tape, 1).ConfigureAwait(false); Assert.Equal(1, tape.Length); Assert.Equal("c", tape[0]); }
public async Task read_all_forward() { var tape = new AllPartitionsRecorder(); await Store.ReadAllAsync(0, tape).ConfigureAwait(false); Assert.Equal(5, tape.Length); Assert.Equal("a", tape[0]); Assert.Equal("b", tape[1]); Assert.Equal("c", tape[2]); Assert.Equal("d", tape[3]); Assert.Equal("e", tape[4]); }
public async Task should_read_from_position(long start, long expected) { await Store.AppendAsync("a", 1, "1").ConfigureAwait(false); await Store.AppendAsync("a", 2, "2").ConfigureAwait(false); await Store.AppendAsync("a", 3, "3").ConfigureAwait(false); var recorder = new AllPartitionsRecorder(); var client = new PollingClient(Store, start, recorder, LoggerFactory); await client.Poll(5000).ConfigureAwait(false); Assert.Equal(expected, recorder.Length); }
public async Task deleted_chunks_should_be_hidden_from_scan() { await Store.AppendAsync("a", 1, "first").ConfigureAwait(false); await Store.AppendAsync("a", 2, "second").ConfigureAwait(false); await Store.AppendAsync("a", 3, "third").ConfigureAwait(false); await Store.DeleteAsync("a", 2, 2).ConfigureAwait(false); var recorder = new AllPartitionsRecorder(); await Store.ReadAllAsync(0, recorder).ConfigureAwait(false); Assert.Equal(2, recorder.Length); Assert.Equal("first", recorder[0]); Assert.Equal("third", recorder[1]); }
// [InlineData(3, 3)] @@TODO enable tombstone! public async Task poller_should_skip_missing_chunks(long missing, long expected) { await Store.AppendAsync("a", 1, "1").ConfigureAwait(false); await Store.AppendAsync("a", 2, "2").ConfigureAwait(false); await Store.AppendAsync("a", 3, "3").ConfigureAwait(false); await Store.DeleteAsync("a", missing, missing).ConfigureAwait(false); var recored = new AllPartitionsRecorder(); var poller = new PollingClient(Store, 0, recored, this.LoggerFactory) { HoleDetectionTimeout = 100 }; var cts = new CancellationTokenSource(20000); await poller.Poll(cts.Token).ConfigureAwait(false); await poller.Poll(cts.Token).ConfigureAwait(false); Assert.Equal(expected, poller.Position); }