VersionPages

How a backend reads an aggregate's streams by version (EventLog.read, EventLog.readEntries): a page of at most SIZE streams at a time, by the version key, each page emitted before the next is read. A read then holds one page, whatever the aggregate's history: a replay from version 1 of an aggregate of hundreds of thousands of streams, which held them all, holds 512. Each page is a call of its own, so a long read holds no connection between pages; a read within one page is one call, as before.

Properties

Link copied to clipboard
const val SIZE: Int = 512

The most streams one call reads.

Functions

Link copied to clipboard
fun <T> byVersion(fromVersion: Int, toVersion: Int, versionOf: (T) -> Int, page: suspend (from: Int) -> List<T>): Flow<T>

The items with versions in fromVersion..toVersion, in version order: page reads at most SIZE of them from a version on, in version order, and versionOf tells an item's version. A page of fewer than SIZE, or one that reaches toVersion, is the last.