Skip to main content

tilo_actions/remote/
store_commands.rs

1//! The records of an app's process, read and written over its own connection to its device
2//! ([`super::RemoteActionMessage::StoreRequest`]).
3
4use super::{ActionCallError, Caller, Pending};
5
6/// What a provider that serves no app's process answers a store command.
7pub const STORE_COMMANDS_UNAVAILABLE: &str =
8    "this connection reaches no app's records: only an app's own connection to its device does";
9
10/// The device's one store, as the process of one app reaches its records.
11pub trait StoreCommands: Send + Sync {
12    /// Answer `command` (`collab_types::store::wire::Command`, as JSON) from `caller` with the
13    /// store's `Reply`, as JSON. Called in the order a connection's commands arrive, so a change
14    /// sent as a run of parts is taken in that order; the answer may come later. A record the
15    /// command founds is of `kind`.
16    fn command(
17        &self,
18        caller: &Caller,
19        command: serde_json::Value,
20        kind: Option<String>,
21    ) -> Pending<Result<serde_json::Value, ActionCallError>>;
22}