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
use holo_hash::HeaderHash;
use holochain_serialized_bytes::prelude::*;
pub use holochain_zome_types::metadata::EntryDhtStatus;
use holochain_zome_types::{HeaderHashed, Timestamp};
use std::collections::BTreeSet;
#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct TimedHeaderHash {
pub timestamp: Timestamp,
pub header_hash: HeaderHash,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, SerializedBytes)]
pub struct MetadataSet {
pub headers: BTreeSet<TimedHeaderHash>,
pub invalid_headers: BTreeSet<TimedHeaderHash>,
pub deletes: BTreeSet<TimedHeaderHash>,
pub updates: BTreeSet<TimedHeaderHash>,
pub entry_dht_status: Option<EntryDhtStatus>,
}
impl From<HeaderHashed> for TimedHeaderHash {
fn from(h: HeaderHashed) -> Self {
let (header, hash) = h.into_inner();
TimedHeaderHash {
timestamp: header.timestamp(),
header_hash: hash,
}
}
}
impl From<HeaderHash> for TimedHeaderHash {
fn from(h: HeaderHash) -> Self {
TimedHeaderHash {
timestamp: Timestamp::now(),
header_hash: h,
}
}
}