How does one determine starting Position when reading backward?

Using ReadAllEventsBackwardAsync, how do I know what my starting position (end of $all) should be? .NET API, 3.8.x client.

… ?

Its just not possible, if you supply a starting position it runs from the start of stream.
What I do is read the very last event using StreamPosition.End to then use that position as stream start when I need to read backwards.


I feel like AllCheckpoint should expose a property for this. AllCheckpoint seems pretty anemic, from a public perspective. Maybe I’m misunderstanding its purpose.

@Charles, it’s possible (and basically you’ve answered it, just save yourself the extra call for the last event and use StreamPosition.End)

If you want to read events backwards, you start with with StreamPosition.End

var last200EventSlice = await conn.ReadAllEventsBackwardAsync(Position.End, 200, false);

first item in that slice will be your most recent event.

As in AllEnd?

Sorry you are right - I forgot what I wrote my code for was to support START being an offset FROM the end.
In my method if you specify a start of 10 it will start reading events 10 events from the end.

I just forgot about my use case - my bad!

Is there an AllEnd, or are you proposing one?

I don’t quite understand the purpose of AllStart on AllCheckpoint …

Position.End seems to be what I needed, thanks.

I am not sure allend is actually used anywhere (might be a historical
thing) will take a look through it.