holochain_types/
metadata.rs1use holo_hash::ActionHash;
4use holochain_serialized_bytes::prelude::*;
5pub use holochain_zome_types::metadata::EntryDhtStatus;
6use holochain_zome_types::prelude::*;
7use std::collections::BTreeSet;
8
9#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq, Clone, Serialize, Deserialize)]
11pub struct TimedActionHash {
12 pub timestamp: Timestamp,
14 pub action_hash: ActionHash,
16}
17
18#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, SerializedBytes)]
21pub struct MetadataSet {
22 pub actions: BTreeSet<TimedActionHash>,
25 pub invalid_actions: BTreeSet<TimedActionHash>,
28 pub deletes: BTreeSet<TimedActionHash>,
30 pub updates: BTreeSet<TimedActionHash>,
32 pub entry_dht_status: Option<EntryDhtStatus>,
36}
37
38impl From<ActionHashed> for TimedActionHash {
39 fn from(h: ActionHashed) -> Self {
40 let (action, hash) = h.into_inner();
41 TimedActionHash {
42 timestamp: action.timestamp(),
43 action_hash: hash,
44 }
45 }
46}
47
48impl From<ActionHash> for TimedActionHash {
49 fn from(h: ActionHash) -> Self {
50 TimedActionHash {
51 timestamp: Timestamp::now(),
52 action_hash: h,
53 }
54 }
55}