p2panda_store/groups/traits.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3use std::error::Error;
4
5/// Trait describing API for setting and getting groups CRDT state by id.
6pub trait GroupsStore<ID, S> {
7 type Error: Error;
8
9 /// Set state for a specified groups instance.
10 fn set_groups_state(&self, id: &ID, state: &S)
11 -> impl Future<Output = Result<(), Self::Error>>;
12
13 /// Get state for a specified groups instance.
14 fn get_groups_state(&self, id: &ID) -> impl Future<Output = Result<Option<S>, Self::Error>>;
15}