diff options
| author | tv <tv@krebsco.de> | 2026-11-20 01:28:41 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-20 02:38:56 +0100 |
| commit | 96a733e1ccbf6dab2d69f263d655e487ac54c20d (patch) | |
| tree | abfa6c292134a224b53e4a70c60a31721577a7bc /src/federation/revision.rs | |
| parent | 7a178877d3b979ae6bd0e48ddb06363a0d50affc (diff) | |
federation: revision 2, the federation's name
A version may give its federation a name (`name`, spelled as a party's),
under a revision that has names: `federation-name`, revision 2. The
first version's is in the root, so a rehearsal named otherwise is
another federation, though its parties, keys, nodes and rules are the
same; a later version changes the name as anything else, which changes
what the federation is called, not which it is. A version giving a name
under an earlier revision is none.
What a version does says so, in words: it names the federation, renames
it, or drops its name. Half the generated histories begin at the newest
revision now, their versions naming the federation anew now and then;
those of the revisions before are generated as they were.
Diffstat (limited to 'src/federation/revision.rs')
| -rw-r--r-- | src/federation/revision.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/federation/revision.rs b/src/federation/revision.rs index 7be6254..2e5464d 100644 --- a/src/federation/revision.rs +++ b/src/federation/revision.rs @@ -16,6 +16,9 @@ pub(crate) enum Feature { /// Merge events: a node its party lists, with its own key, builds on events it holds, /// writing nothing (`Does::Merge`). MergeEvents, + /// The federation's name, in its versions (`Version::name`): the first version's, in + /// the root, parts it from a federation of a first version alike otherwise. + FederationName, } impl Feature { @@ -24,6 +27,7 @@ impl Feature { pub(crate) fn name(self) -> &'static str { match self { Feature::MergeEvents => "merge-events", + Feature::FederationName => "federation-name", } } @@ -34,6 +38,10 @@ impl Feature { "merge events, which a node its party lists signs with its own key, building \ on events it holds and writing nothing" } + Feature::FederationName => { + "the federation's name, which a version gives it and a later one changes: the \ + first version's, in the root, parts it from a federation alike otherwise" + } } } @@ -49,7 +57,7 @@ impl Feature { /// The features, in the order revisions add them: revision n has the first n, the base /// revision none. Only ever appended to. -pub(crate) const FEATURES: &[Feature] = &[Feature::MergeEvents]; +pub(crate) const FEATURES: &[Feature] = &[Feature::MergeEvents, Feature::FederationName]; /// A revision: how many of `FEATURES` it has. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] @@ -158,6 +166,14 @@ mod tests { Id::of(br#"["merge-events"]"#), "a released revision's ID changes never" ); + assert_eq!( + Revision(2).id(), + Id::of(br#"["merge-events","federation-name"]"#) + ); + assert_eq!( + Feature::FederationName.revision().to_string(), + "revision 2 (merge-events, federation-name)" + ); let names: Vec<&str> = FEATURES.iter().map(|feature| feature.name()).collect(); let distinct: std::collections::BTreeSet<&str> = names.iter().copied().collect(); assert_eq!(distinct.len(), names.len(), "a feature named twice"); |
