콘텐츠로 이동
한국어

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.

new CassandraRememberEntitiesStore(options): CassandraRememberEntitiesStore

Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:54

CassandraRememberEntitiesStoreOptions

CassandraRememberEntitiesStore

append(typeName, event): Promise<void>

Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:78

Persist a single entity-lifecycle event.

string

RememberEvent

Promise<void>

RememberEntitiesStore.append


clear(typeName): Promise<void>

Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:125

Forget every event for typeName. Used by tests + reset tooling.

string

Promise<void>

RememberEntitiesStore.clear


close(): Promise<void>

Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:134

Promise<void>


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.

string

Promise<RememberEvent[]>

RememberEntitiesStore.load


start(): Promise<void>

Defined in: src/cluster/sharding/CassandraRememberEntitiesStore.ts:60

Promise<void>