CassandraRememberEntitiesStore
このコンテンツはまだ日本語訳がありません。
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:47
Cassandra-backed RememberEntitiesStore for ClusterSharding (#84)
— the natural complement to the existing JournalRememberEntitiesStore
for deployments using Cassandra/Scylla as their event journal.
Schema design. State-based, not event-sourced. Each known
(type, shard, entity) triple lives as a single row with a
started_at timestamp; stopped events translate into a row
delete, started events into an upsert. This is materially
cheaper to reload than the journal-backed implementation (one
partition scan vs. replaying every lifecycle event ever recorded
for the type) at the cost of losing history — but the
coordinator only needs the current entity set.
Partition layout. Partition key is type_name; clustering
key is (shard_id, entity_id). Every entity for a given sharded
type lands in one partition. Acceptable for typical workloads
(thousands of entities per type, fits comfortably in a single
Cassandra partition); for very large entity sets, switch to the
journal-backed store or split the partition by shard_id (the
standard Cassandra “wide-row → composite-key” workaround).
clear semantics. Issues DELETE FROM tbl WHERE type_name = ?
— a whole-partition delete, atomic in Cassandra. Scoping resets to
one type at a time matches JournalRememberEntitiesStore.
Replay shape. load returns synthetic 'started' events for
every row currently in the partition. No 'stopped' events are
emitted because they were applied via DELETE at write time —
ShardCoordinator reapplies the result to its in-memory map and
arrives at the same entitiesPerShard view the event-replay
variant produces.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CassandraRememberEntitiesStore(
options):CassandraRememberEntitiesStore
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:54
Parameters
Section titled “Parameters”options
Section titled “options”CassandraRememberEntitiesStoreOptions
Returns
Section titled “Returns”CassandraRememberEntitiesStore
Methods
Section titled “Methods”append()
Section titled “append()”append(
typeName,event):Promise<void>
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:78
Persist a single entity-lifecycle event.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear(
typeName):Promise<void>
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:125
Forget every event for typeName. Used by tests + reset tooling.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”close()
Section titled “close()”close():
Promise<void>
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:134
Returns
Section titled “Returns”Promise<void>
load()
Section titled “load()”load(
typeName):Promise<RememberEvent[]>
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:110
Replay every event ever recorded for typeName, in append order.
Returns an empty array if nothing’s been written. Called once
per coordinator preStart.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
Returns
Section titled “Returns”Promise<RememberEvent[]>
Implementation of
Section titled “Implementation of”start()
Section titled “start()”start():
Promise<void>
Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:60
Returns
Section titled “Returns”Promise<void>
