MongoSnapshotQueryStorage

class MongoSnapshotQueryStorage @JvmOverloads constructor(client: MongoClient, databaseName: String, val context: String, val options: MongoQueryOptions = MongoQueryOptions(), dispatcher: CoroutineDispatcher = VirtualThreads.dispatcher, readPreference: ReadPreference? = null) : CachedQueryBindings<AggregateType>

The snapshot query storage of one bounded context on MongoDB: the MongoSnapshotQueryBackend of each of its aggregate types, over that aggregate's own snapshot collection, which MongoSnapshotStore writes, with the facts MongoQuerySchemaAdapter reads from the collection; and the management of its query indexes (manageIndexes). readPreference moves the queries off the primary (secondaryPreferred, say), at the cost of reading snapshots a little behind the ones a command's default wait waited for; the primary's by default. The indexes are managed on the primary.

Constructors

Link copied to clipboard
constructor(client: MongoClient, databaseName: String, context: String, options: MongoQueryOptions = MongoQueryOptions(), dispatcher: CoroutineDispatcher = VirtualThreads.dispatcher, readPreference: ReadPreference? = null)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

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

The snapshot collection of aggregateName.

Link copied to clipboard

Manages indexes (planned by MongoQueryIndexes.plan for aggregates of this context) as MongoQueryOptions.indexDdl says. Blocking: a host calls it once at startup. auto makes sure of a missing collection as the snapshot store does (its format record and key) before it indexes it.