p2panda_auth/traits/resolver.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3use std::fmt::Debug;
4
5use crate::traits::{IdentityHandle, OperationId};
6
7/// Interface for implementing a custom group crdt resolver.
8pub trait Resolver<ID, OP, C, M>
9where
10 ID: IdentityHandle,
11 OP: OperationId + Ord,
12{
13 type State;
14 type Error: Debug;
15
16 /// Check if this message requires that a full state re-build takes place. This would usually
17 /// be due to concurrent operations arriving which require special handling.
18 fn rebuild_required(y: &Self::State, msg: &M) -> Result<bool, Self::Error>;
19
20 /// Process all operations and update internal state as required.
21 ///
22 /// This could include updating any internal filter object.
23 #[allow(clippy::type_complexity)]
24 fn process(y: Self::State) -> Result<Self::State, Self::Error>;
25}