r.0.9.1.source-code.TotalOrderedLogExt.kt Maven / Gradle / Ivy
The newest version!
package se.wollan.tolr
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
suspend fun TotalOrderedLog.listRecordsByType(pattern: RecordTypePattern): Flow = flow {
var since: NodeTimestamp = NodeTimestamp.initial
while (true) {
val page = listRecordsByTypeLaterThan(pattern, since)
for (r in page.records)
emit(r)
since = page.next ?: break
}
}