Expand description
The GridWork kernel: the PostgreSQL implementation behind the gwk
contract.
gwk-domain says WHAT the contract is; this crate is one engine’s answer to
it. The split is load-bearing — everything backend-specific (this crate, the
gwk_internal schema, the migrations beside it) stays on this side of the
line, and schema/0001_contract.sql stays engine-neutral so a second
backend has something to conform to.
What is here so far: configuration, the embedded contract DDL and its fingerprint, the one-shot initializer, the fenced append store, the epoch that seals a fresh log until it is activated, the work lifecycle’s command path and projections, and the blob spine — the encrypted container format and the store that dedups, pins, sweeps, rotates and shreds it, the projection snapshots, and the recovery that decides what a restart may claim about them. The wire server lands on top of them.
Re-exports§
pub use admin::InitOutcome;pub use admin::RoleAttributes;pub use admin::RuntimePrivileges;pub use admin::TargetState;pub use blob::store::PgBlobStore;pub use blob::store::UPLOAD_EXPIRY_SECS;pub use config::AdminConfig;pub use config::BlobConfig;pub use config::DEFAULT_SOCKET_PATH;pub use config::KernelConfig;pub use epoch::GENESIS_KEY;pub use epoch::KERNEL_AGGREGATE;pub use epoch::KERNEL_SINGLETON;pub use epoch::SYSTEM_PROJECT;pub use error::KernelError;pub use error::Result;pub use project::Refusal;pub use recover::RebuildReport;pub use recover::RecoveryReport;pub use recover::Verdict;pub use store::EVENT_CHANNEL;pub use store::MAX_INFLIGHT_APPENDS;pub use store::PgEventStore;pub use store::connect_pool;pub use wire::WireError;pub use wire::hello::OFFERED_CAPABILITIES;pub use wire::hello::Readiness;pub use wire::hello::Session;pub use writer::WRITER_LOCK_KEY;pub use writer::WriterLock;pub use writer::claim_epoch;
Modules§
- admin
- One-shot initialization of a target database.
- authority
- Authority evaluation: which commands are gated, and what the gate answers.
- blob
- Content-addressed blob storage: the encrypted container and the store above it.
- checkpoint
- Projection snapshots: the recovery shortcut, never the truth.
- config
- Process configuration, read from the environment.
- contract_
sql - epoch
- The epoch: one genesis append, the seal it opens under, and the activation that breaks it.
- error
- What can go wrong.
- numeric
- Checked conversion between wire
u64counters and PostgreSQLnumeric(20,0). - project
- Event → projection rows.
- recover
- Recovery: what a restart is allowed to CLAIM about the projections.
- store
- The PostgreSQL
EventStore. - submit
- The command path: one
CommandEnvelopein, one committed event plus its projection out. - wire
- The local wire: frames in, control values out.
- writer
- Singleton write authority: the advisory boot lock and the durable epoch.
Constants§
- CONTRACT_
SQL - Every byte of
schema/0001_contract.sql. The script wraps itself inBEGIN/COMMIT, so it is applied whole and never inside another transaction. - CONTRACT_
SQL_ SHA256 - SHA-256 of
CONTRACT_SQL, lowercase hex. Initialization records this ingwk_internal.schema_fingerprint, so a later boot can tell “this database carries MY contract” from “this database carries another”.