Expand description
hakocluster: dispatcher over N hakodb instances (Fase 2).
Full design: hakodb/hakocluster#1.
Cluster::open[_with_config]— oneHakoper data dir + full-meshsocket_syncpeering (one connection per pair,idialsj > i).- Reads (
get/query) fan out round-robin across healthy instances. - Writes (
put/put_owned/delete) route to the designated writer,instances[0]by convention. - Fase 2 adds: stagger policy (same interval + spaced opens, or
per-instance intervals) and a lag guard (eject replicas trailing the
writer by more than
max_replica_lag_versions, re-admit at half). - Replicated writes join each instance’s normal write/flush queue (that
is
SocketSync’s own behavior); the cluster adds no flush paths.
Non-unix: socket_sync compiles out (same rule as hakodb), so peering
is unavailable — open with N > 1 fails closed; N = 1 works as a
degenerate single-node cluster.
Modules§
- ffi
- C ABI over JSON for non-Rust consumers (go, pascal, …).
Structs§
- Cluster
- One clustered engine: N instances, one logical dataset.
- Cluster
Config - Fase 2 cluster configuration.
- Databases
- N named databases in one process. Selection is by exact name; there is no default database (a silent default routes writes somewhere the operator did not choose).
- DbSpec
- One named database declaration for
Databases::open. - Promotion
- One promotion record: which epoch moved the writer where, and when.
Operators use epochs to order promotions (a higher epoch supersedes);
the actual fence is the read-only flags
Cluster::promotesets. - Replica
Health - Per-instance health from
Cluster::refresh_health.
Enums§
- Stagger
Policy - Flush-cadence stagger policy (issue #1: flush cadence is the ONLY knob — never skip the queue, no direct-flush paths).
Functions§
- valid_
db_ name - Database name gate: same discipline as collection segments
(
[A-Za-z0-9_-], 1–128, no__prefix). The name becomes a sock subdir, so traversal shapes are refused here, not downstream.