1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Types related to an agents for chain activity
use crate::warrant::WarrantOp;
use holo_hash::ActionHash;
use holo_hash::AgentPubKey;
use holo_hash::HasHash;
use holochain_serialized_bytes::prelude::*;
use holochain_timestamp::Timestamp;
use holochain_zome_types::prelude::*;
mod chain_item;
pub use chain_item::*;
/// Intermediate data structure used during a `must_get_agent_activity` call.
/// Note that this is not the final return value of `must_get_agent_activity`.
#[derive(Debug, Clone, PartialEq, Eq, SerializedBytes, Serialize, Deserialize)]
pub enum MustGetAgentActivityResponse {
/// The activity was found.
Activity {
/// The actions performed by the agent.
activity: Vec<RegisterAgentActivity>,
/// Any warrants issued to the agent for this activity.
warrants: Vec<WarrantOp>,
},
/// The requested chain top and filter conditions were successfully met, but there were missing
/// actions within the filtered range that prevented building a complete chain section.
IncompleteChain,
/// While walking the chain in reverse order, the requested until hash was not found.
///
/// This either means that there is data missing for this chain, or the requested hash does not
/// below to the queried chain.
UntilHashMissing(ActionHash),
/// The requested until timestamp range could not be proven complete.
///
/// This includes the case where no returned actions satisfy the timestamp, and the case where
/// actions satisfy it but there is no deterministic lower-bound witness (an action with
/// timestamp below the limit) and the returned chain does not reach genesis.
UntilTimestampIndeterminate(Timestamp),
/// The requested chain top was not found in the chain.
ChainTopNotFound(ActionHash),
/// The `until_hash` filter specifies an action with a sequence number greater than the
/// `chain_top`'s sequence number.
///
/// This is an impossible filter condition to create a response to because `until_hash` must be
/// at or before `chain_top` in the chain.
UntilHashAfterChainHead(ActionHash),
/// The `until_timestamp` filter specifies a timestamp greater than the `chain_top` action's
/// timestamp.
///
/// This is an impossible filter condition to create a response to because `until_timestamp`
/// must be at or before the `chain_top`'s timestamp.
UntilTimestampGreaterThanChainHead(Timestamp),
}
impl MustGetAgentActivityResponse {
/// Constructor
#[cfg(feature = "test_utils")]
pub fn activity(activity: Vec<RegisterAgentActivity>) -> Self {
Self::Activity {
activity,
warrants: vec![],
}
}
}