diff options
| author | tv <tv@krebsco.de> | 2026-11-16 19:30:05 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-16 21:24:12 +0100 |
| commit | 7f31a5bca06dccdd4edaed6699bc6e6f479a2b27 (patch) | |
| tree | 3dd93feb5a3cccd714c887ce11d0ec44b88eab9f /src/federation | |
| parent | b6a9f75d1abe94836eb6d5152ebcc03d2472e252 (diff) | |
store: a fold names itself
A swarm holding a store names its fold in its policy, `{"version": 2, "store":
"<fold>"}`: the fold's name is a constant of the fold, `federation` for the federation and
`test` for the fold made for the store's tests.
Diffstat (limited to 'src/federation')
| -rw-r--r-- | src/federation/fold.rs | 2 | ||||
| -rw-r--r-- | src/federation/store/mod.rs | 4 | ||||
| -rw-r--r-- | src/federation/store/testfold.rs | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/federation/fold.rs b/src/federation/fold.rs index 5f794e6..ad9ff59 100644 --- a/src/federation/fold.rs +++ b/src/federation/fold.rs @@ -514,6 +514,8 @@ impl State { impl Fold for Federation { type State = State; + const NAME: &'static str = "federation"; + const LARGEST: usize = event::LARGEST; fn dependencies(event: &[u8]) -> Option<Vec<Id>> { diff --git a/src/federation/store/mod.rs b/src/federation/store/mod.rs index ad1720d..ec3fb56 100644 --- a/src/federation/store/mod.rs +++ b/src/federation/store/mod.rs @@ -72,6 +72,10 @@ pub(crate) trait Fold { /// reading need of the events' history. type State: Clone; + /// Its name, by which a swarm holding a store names its fold (`docs/store.md`, On + /// Automerge). + const NAME: &'static str; + /// The most bytes an event may have: larger ones are none. const LARGEST: usize; diff --git a/src/federation/store/testfold.rs b/src/federation/store/testfold.rs index baaba55..bf23321 100644 --- a/src/federation/store/testfold.rs +++ b/src/federation/store/testfold.rs @@ -289,6 +289,8 @@ pub(crate) struct TestFold; impl Fold for TestFold { type State = State; + const NAME: &'static str = "test"; + const LARGEST: usize = 64 * 1024; fn dependencies(event: &[u8]) -> Option<Vec<Id>> { |
