Skip to content

CassandraRememberEntitiesStoreOptions

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

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.

readonly optional autoCreateKeyspace?: boolean

Defined in: src/persistence/journals/CassandraClient.ts:42

If true, create the keyspace on startup (simple strategy, rf=1). Dev-friendly default.

CassandraConnection.autoCreateKeyspace


readonly optional autoCreateTables?: boolean

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

Auto-create the table on first use. Default: true.


readonly optional client?: CassandraClientLike

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

Inject a pre-built CQL client. When omitted, the store instantiates its own (via cassandra-driver) — but typical deployments share one client across journal + snapshot store + remember-entities, so passing the existing one in is the recommended pattern.


readonly optional consistency?: number

Defined in: src/persistence/journals/CassandraClient.ts:55

CQL consistency level to use for all reads and writes. Default: LOCAL_QUORUM (value 6 in the driver). Pass the numeric value from cassandra-driver’s types.consistencies.

CassandraConnection.consistency


readonly contactPoints: readonly string[]

Defined in: src/persistence/journals/CassandraClient.ts:32

Node(s) to seed the cluster topology from.

CassandraConnection.contactPoints


readonly optional credentials?: object

Defined in: src/persistence/journals/CassandraClient.ts:38

Optional username/password for PLAIN auth.

password: string

username: string

CassandraConnection.credentials


readonly keyspace: string

Defined in: src/persistence/journals/CassandraClient.ts:36

Keyspace to USE after connect. Must already exist, or pass autoCreateKeyspace: true.

CassandraConnection.keyspace


readonly optional localDataCenter?: string

Defined in: src/persistence/journals/CassandraClient.ts:34

Local DC — required for DCAwareRoundRobinPolicy. Defaults to datacenter1.

CassandraConnection.localDataCenter


readonly optional port?: number

Defined in: src/persistence/journals/CassandraClient.ts:40

Port — defaults to 9042.

CassandraConnection.port


readonly optional replication?: object

Defined in: src/persistence/journals/CassandraClient.ts:44

Replication settings used by autoCreateKeyspace. Ignored otherwise.

readonly optional class?: "SimpleStrategy" | "NetworkTopologyStrategy"

readonly optional dataCenters?: Readonly<Record<string, number>>

For NetworkTopologyStrategy, map of DC → replication factor.

readonly optional replicationFactor?: number

CassandraConnection.replication


readonly optional table?: string

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

Table for the remember-entities state. Default: remember_entities.