aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/store/testfold.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/federation/store/testfold.rs')
-rw-r--r--src/federation/store/testfold.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/federation/store/testfold.rs b/src/federation/store/testfold.rs
index bf23321..2478c0a 100644
--- a/src/federation/store/testfold.rs
+++ b/src/federation/store/testfold.rs
@@ -6,7 +6,8 @@
//! holds is its latest put, none other having it in its history, then the lowest ID.
//! * `lock`: a key locked for good.
//! * `era`: era `n`, taken only where `n` is one past the era at its history; of two of one
-//! number, a node keeps the first it takes (as the federation's versions).
+//! number, a node keeps the first it takes (as the federation's versions). Eras of one
+//! number and tag write the same: a drop of one refuses them all.
//! * `cut`: cut `n`, naming heads to move the store to, as `era`: above the heads the latest
//! cut of its history names, and holding that cut (or after the checkpoint the state
//! starts from, where it holds none); none of them in another's history. It must be above
@@ -362,6 +363,13 @@ impl Fold for TestFold {
}
}
+ fn writes(event: &[u8]) -> Option<Id> {
+ match decode(event)? {
+ (_, Kind::Era { n, tag }) => Some(Id::of(format!("era {n} {tag}").as_bytes())),
+ _ => None,
+ }
+ }
+
fn checkpoint(at: &State, heads: &[Id]) -> (Vec<u8>, Vec<Id>) {
let keeps: Vec<Id> = at.counting().into_values().collect();
let checkpoint = Checkpoint {