Skip to main content

Module server

Module server 

Source
Expand description

Leader-side replication server for FixedStore.

  • Spawns a TCP acceptor thread.
  • On the first accepted follower connection, installs SPSC producers into every shard (lazy install — Mitigation B of spec §5/§7).
  • Each accepted connection spawns a per-shard serve thread that does Phase 1 (full scan catch-up, honoring FLAG_EMPTY_STATE to skip DELETED slots) then Phase 2 (SPSC streaming) if the per-shard consumer is still available.

Single-follower-streaming-per-shard constraint: the SPSC consumer for each shard is held by at most one connection at a time. If a concurrent follower tries to claim a consumer that is already taken the server sends an Error frame and returns, letting the client reconnect later. When a connection finishes (cleanly or on error), ShardConsumerGuard::drop returns the consumer to the pending slot so the next connection can claim it and enter Phase-2 streaming.

Structs§

FixedReplicationServer

Constants§

SPSC_CAPACITY