kurrentdb/operation/read_all

Build read-all requests.

This module contains the sans-IO request builder for KurrentDB’s Streams/Read method when reading the $all stream. Decoding of response messages is shared with kurrentdb/operation/read_stream because the wire shape is the same.

Types

Configuration for a finite $all read.

pub opaque type Configuration

Direction in which $all is read.

pub type Direction {
  Forwards
  Backwards
}

Constructors

  • Forwards

    Read from lower log positions to higher log positions.

  • Backwards

    Read from higher log positions to lower log positions.

Server-side filter applied to $all reads and subscriptions.

pub type Filter {
  NoFilter
  EventTypePrefix(prefixes: List(String), window: FilterWindow)
  EventTypeRegex(regex: String, window: FilterWindow)
  StreamNamePrefix(prefixes: List(String), window: FilterWindow)
  StreamNameRegex(regex: String, window: FilterWindow)
}

Constructors

  • NoFilter

    Do not filter events.

  • EventTypePrefix(prefixes: List(String), window: FilterWindow)

    Include events whose type starts with one of the prefixes.

  • EventTypeRegex(regex: String, window: FilterWindow)

    Include events whose type matches the regular expression.

  • StreamNamePrefix(prefixes: List(String), window: FilterWindow)

    Include events whose stream name starts with one of the prefixes.

  • StreamNameRegex(regex: String, window: FilterWindow)

    Include events whose stream name matches the regular expression.

Checkpoint window configuration for filtered $all operations.

pub type FilterWindow {
  FilterMax(Int)
  FilterCount
}

Constructors

  • FilterMax(Int)

    Ask the server to emit checkpoints at most every Int events.

  • FilterCount

    Ask the server to use count-based checkpoints.

Starting position for reading $all.

pub type Position {
  FromStart
  FromEnd
  FromPosition(commit_position: Int, prepare_position: Int)
}

Constructors

  • FromStart

    Start at the beginning of the transaction log.

  • FromEnd

    Start at the end of the transaction log.

  • FromPosition(commit_position: Int, prepare_position: Int)

    Start at a specific commit and prepare position.

Values

pub fn configure() -> Configuration

Create read-all configuration with default values.

Defaults are forwards, from the start of $all, at most 1000 events, link resolution disabled, and no filter.

pub fn direction(
  config: Configuration,
  direction: Direction,
) -> Configuration

Set the read direction.

pub fn filter(
  config: Configuration,
  filter: Filter,
) -> Configuration

Set the server-side $all filter.

pub fn max_count(
  config: Configuration,
  max_count: Int,
) -> Configuration

Set the maximum number of events to read.

pub fn position(
  config: Configuration,
  position: Position,
) -> Configuration

Set the starting transaction log position.

pub fn request(
  client: kurrentdb.Client,
  config config: Configuration,
) -> request.Request(BitArray)

Build a finite Streams/Read request for $all.

pub fn resolve_links(
  config: Configuration,
  resolve_links: Bool,
) -> Configuration

Enable or disable link-to-event resolution.

Search Document