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.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/federation/store/testfold.rs b/src/federation/store/testfold.rs
index 2478c0a..17e039b 100644
--- a/src/federation/store/testfold.rs
+++ b/src/federation/store/testfold.rs
@@ -7,7 +7,8 @@
//! * `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). Eras of one
-//! number and tag write the same: a drop of one refuses them all.
+//! number and tag write the same: a drop of one refuses them all. One tagged `new` is
+//! of a fold knowing more: a node that would take it stops at it.
//! * `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
@@ -347,6 +348,15 @@ impl Fold for TestFold {
}
}
+ fn stops(at: &State, now: &State, _id: &Id, event: &[u8]) -> Option<String> {
+ match decode(event)? {
+ (_, Kind::Era { n, tag }) if tag == "new" && now.era == at.era => {
+ Some(format!("era {n}, tagged new"))
+ }
+ _ => None,
+ }
+ }
+
fn keeps(now: &State, _id: &Id, event: &[u8]) -> bool {
match decode(event) {
Some((_, Kind::Era { n, tag })) => {