diff options
Diffstat (limited to 'src/state/mod.rs')
| -rw-r--r-- | src/state/mod.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs index 36dab9d..5fefe11 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -387,6 +387,30 @@ impl AppState { crate::document::KIND } + /// Whether this node's document is a set of events (`federation::store::set`): + /// the Automerge document it holds is empty then, and nothing passes it on. + pub(crate) fn of_a_set(&self) -> bool { + #[cfg(feature = "federation")] + { + self.holding.of_a_set() + } + #[cfg(not(feature = "federation"))] + { + false + } + } + + /// The members' entries as a document has them, where this node's document keeps + /// them apart (a set of events, `Holding::entries`): none, where they are in the + /// document it holds. + pub(crate) fn entries(&self) -> Option<crate::document::view::Tree> { + #[cfg(feature = "federation")] + if self.of_a_set() { + return self.holding.entries(); + } + None + } + pub(crate) fn local_id(&self) -> &str { self.transport.local_id() } |
