PostgresEventQueryStorage

class PostgresEventQueryStorage @JvmOverloads constructor(dataSource: DataSource, val context: String, val options: PostgresQueryOptions = PostgresQueryOptions(), dispatcher: CoroutineDispatcher = VirtualThreads.dispatcher) : CachedQueryBindings<AggregateType>

The events query storage of one bounded context on PostgreSQL: the PostgresQueryBackend of each of its aggregate types over that aggregate's own log table (wow_log__<ctx>__<agg>), which PostgresEventLog appends to, with the facts of PostgresEventStorageAdapter. One record per stream, as stored.

The log is the write store: its indexes are the version key (tenant_id, aggregate_id, version), the request key (tenant_id, request_id), the position (partition, sequence) and those of the access attributes, each partial on the attribute holding a value (PostgresQueryIndexes.planLog), so a query under an access policy uses its attributes' indexes, and any other that does not pin the aggregate (or the request) scans the aggregate type's table. The entry's budget bounds it (statement_timeout, sizes, the count limit); an analytics-heavy deployment serves the model from ClickHouse or Elasticsearch.

Constructors

Link copied to clipboard
constructor(dataSource: DataSource, context: String, options: PostgresQueryOptions = PostgresQueryOptions(), dispatcher: CoroutineDispatcher = VirtualThreads.dispatcher)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun table(aggregateName: String): String

The log table of aggregateName, quoted.