refactor(swarm-queue-client): share the hive-status bucket's name and shape
The bucket has two ends in two crates: a hive writes its own key, the controller reads every key. `swarm-controller` declared the name as a private const with a doc comment arguing that "reader and writer must name the same bucket" — an argument the writer, in another crate, could not obey. The name is the mild half. Both ends do get-or-create, because either may come up first on a fresh swarm and neither can assume the other has run. Two `Config`s that drift means whichever end created the bucket wins and the other's `get_key_value` succeeds against a bucket it did not ask for: no error, no log, just a retention policy nobody chose. Sharing the constructor gives that race one outcome. Behind a default-off `kv` feature, so the crate's other consumer — the auth-callout responder, which speaks the connect and nothing else — still pulls neither `jetstream` nor `kv`. That was the actual reason the feature was excluded when this crate was extracted; the flag preserves it. The surface is deliberately narrow: one bucket's name and creation config, not a general KV facade.
This commit is contained in:
parent
6712cdb796
commit
22659234c4
6 changed files with 119 additions and 41 deletions
|
|
@ -112,6 +112,12 @@ pub fn chain(error: &dyn std::error::Error) -> String {
|
|||
rendered
|
||||
}
|
||||
|
||||
/// The hive-status KV bucket, shared by the hive that writes it and the
|
||||
/// controller that reads it. Behind the `kv` feature — see the module doc
|
||||
/// for why a bucket name and its config belong to neither end alone.
|
||||
#[cfg(feature = "kv")]
|
||||
pub mod status;
|
||||
|
||||
/// Only the one field this needs; authelia returns several.
|
||||
#[derive(serde::Deserialize)]
|
||||
struct TokenResponse {
|
||||
|
|
|
|||
Loading…
Reference in a new issue