holochain_integrity_types/
validate.rs

1use holo_hash::AgentPubKey;
2use holo_hash::AnyDhtHash;
3use holochain_serialized_bytes::prelude::*;
4
5use crate::chain::ChainFilter;
6
7#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, SerializedBytes)]
8pub enum ValidateCallbackResult {
9    Valid,
10    Invalid(String),
11    /// Subconscious needs to map this to either pending or abandoned based on context that the
12    /// wasm can't possibly have.
13    UnresolvedDependencies(UnresolvedDependencies),
14}
15
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17/// Unresolved dependencies that are either a set of hashes
18/// or an agent activity query.
19pub enum UnresolvedDependencies {
20    Hashes(Vec<AnyDhtHash>),
21    AgentActivity(AgentPubKey, ChainFilter),
22}
23
24/// The level of validation package required by
25/// an entry.
26#[derive(
27    Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
28)]
29pub enum RequiredValidationType {
30    /// Just the record (default)
31    Record,
32    /// All chain items of the same entry type
33    SubChain,
34    /// The entire chain
35    Full,
36}
37
38impl Default for RequiredValidationType {
39    fn default() -> Self {
40        Self::Record
41    }
42}