From 9fa28bb06692cd3e9d06b678d3dfe2595d328a5f Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 21:30:24 +0000 Subject: api: a swarm holding a store at a node's API Behind the `federation` feature, a node of a swarm holding a store has, at its API (`docs/store.md`, Members; `docs/openapi.yaml`, Events): * `GET /events`: its store's ID, its checkpoint's, its heads, and how many events it took after its checkpoint; * `POST /events`: an event put, whoever signed it, offered to the store and written into the document at its ID unless the store refuses it (`422`, with why): taken, held, or waiting for what it builds on; * `GET /events/{id}`: an event the store holds, or its checkpoint, as its bytes; * `GET /events/counts`: what counts as the store reads now: the current version, each party's keys and nodes, the values at places, the members; * `GET /events/refused`: what the store refused, its own refusals apart, its operator's drops, and the rest with why; * `POST /admin/events/drop` and `/admin/events/allow`: its operator has it drop what it took, and take it back. The events' endpoints are anyone's this node lets in, as the store's are; dropping and taking back need `write` on `_continuum`, as what operators do. While a node holds no store, they answer `404`. --- src/api/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/api/mod.rs') diff --git a/src/api/mod.rs b/src/api/mod.rs index 97724ff..d91c434 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -10,6 +10,8 @@ mod cors; mod dashboard; mod debug; mod document; +#[cfg(feature = "federation")] +mod events; mod health; pub(crate) mod listen; mod log; @@ -102,6 +104,11 @@ pub(crate) fn router(state: AppState, auth_state: AuthState, debug_api: bool) -> api = api.merge(dashboard::router(state.clone())); } + #[cfg(feature = "federation")] + { + api = api.merge(events::router()); + } + if debug_api { warn!("Debug API enabled"); api = api.route( -- cgit v1.3.1