betex
Deterministic, event-sourced matching engine for exchange odds and binary prediction markets.
WAL Locking
Mutable WAL opens take a fail-fast single-writer lock on WAL_ROOT/.writer.lock.
This prevents two writer processes from accidentally opening the same WAL root at the same time.
The lock is held for the lifetime of the mutable journal handler and is released automatically
when the process exits. Read-only recovery via JournalReader does not take the writer lock.
This locking model is intended for local filesystems and single-attach block storage, including
typical Kubernetes deployments backed by ReadWriteOnce / ReadWriteOncePod persistent disks.
It is not a complete fencing solution for shared RWX storage such as GKE Filestore, NFS, SMB, or other multi-node shared-disk environments. Those deployments need an external lease or fencing mechanism in addition to any local file lock.