1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Namespace rotation helpers.
//!
//! For iroh-docs-based stores (`KeyValueStore`, `DocumentStore`), the write capability is the
//! namespace secret. Once a node receives a write ticket it holds that secret forever, so
//! removing a key from the `write` role in the access controller only stops *future* grants —
//! it cannot retract a secret a compromised writer already has.
//!
//! The supported way to truly revoke a writer is to **rotate the namespace**: create a fresh
//! namespace (new `NamespaceId`/secret), migrate the current state into it, and redistribute
//! new tickets (write to the writers you still trust, read to the readers). The old namespace
//! is then abandoned.
//!
//! This module provides the mechanical core of that procedure. The full operational runbook
//! lives in `docs/NAMESPACE_ROTATION.md`.
use crate;
use crateKeyValueStore;
use ;
/// Copies every key/value pair from `src` into `dst`, returning the number of keys copied.
///
/// This is the state-migration step of a key-value namespace rotation: after creating a fresh
/// namespace (a new writer store, with a new namespace secret), the current state is copied
/// into it. `dst` must be writable; if it is a read-only replica, `put` will fail.
///
/// Note that this reads `src`'s current *local* view via [`KeyValueStore::all`]. For a faithful
/// rotation, run it on a writer node whose replica is fully synced.
pub async