aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
Diffstat (limited to 'src/state')
-rw-r--r--src/state/host.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/state/host.rs b/src/state/host.rs
index 47fd946..a48a6fb 100644
--- a/src/state/host.rs
+++ b/src/state/host.rs
@@ -246,6 +246,25 @@ impl Host for AppState {
async move { state.mutate_doc(f).await }
}
+ fn commit_doc_for<T, E, F>(
+ &self,
+ user: Option<String>,
+ f: F,
+ ) -> impl Future<Output = Result<T, E>> + Send
+ where
+ F: FnOnce(&mut Transaction<'_>) -> Result<T, E> + Send + 'static,
+ T: Send + 'static,
+ E: From<StoreError> + Send + 'static,
+ {
+ let state = self.clone();
+ async move {
+ state
+ .mutate_doc_for(user, crate::document::signatures::Sign::Protocol, f)
+ .await
+ .map(|(out, _)| out)
+ }
+ }
+
fn superseded(&self) -> crate::remake::Superseded {
self.superseded_writes
}