use holo_hash::ActionHash;
use holochain_serialized_bytes::prelude::*;
pub use holochain_zome_types::metadata::EntryDhtStatus;
use holochain_zome_types::{ActionHashed, Timestamp};
use std::collections::BTreeSet;
#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct TimedActionHash {
pub timestamp: Timestamp,
pub action_hash: ActionHash,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, SerializedBytes)]
pub struct MetadataSet {
pub actions: BTreeSet<TimedActionHash>,
pub invalid_actions: BTreeSet<TimedActionHash>,
pub deletes: BTreeSet<TimedActionHash>,
pub updates: BTreeSet<TimedActionHash>,
pub entry_dht_status: Option<EntryDhtStatus>,
}
impl From<ActionHashed> for TimedActionHash {
fn from(h: ActionHashed) -> Self {
let (action, hash) = h.into_inner();
TimedActionHash {
timestamp: action.timestamp(),
action_hash: hash,
}
}
}
impl From<ActionHash> for TimedActionHash {
fn from(h: ActionHash) -> Self {
TimedActionHash {
timestamp: Timestamp::now(),
action_hash: h,
}
}
}