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
64
65
66
67
68
69
70
71
//! v2 of [`FlatOp`](crate::flat_op::FlatOp), expressed over the v2
//! `holochain_integrity_types::dht_v2::Action`. Transitional staging module;
//! promoted to replace `flat_op` in the legacy-deletion phase.
use holo_hash::{ActionHash, AgentPubKey, AnyLinkableHash, DnaHash, EntryHash};
use holochain_integrity_types::dht_v2::Action;
use holochain_integrity_types::{LinkTag, MembraneProof, UnitEnum};
mod flat_op_activity;
mod flat_op_entry;
mod flat_op_record;
pub use flat_op_activity::*;
pub use flat_op_entry::*;
pub use flat_op_record::*;
/// v2 of [`FlatOp`](crate::flat_op::FlatOp), over the v2 `dht_v2::Action`.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FlatOp<ET, LT>
where
ET: UnitEnum,
{
/// See [`crate::flat_op::FlatOp::StoreRecord`].
StoreRecord(OpRecord<ET, LT>),
/// See [`crate::flat_op::FlatOp::StoreEntry`].
StoreEntry(OpEntry<ET>),
/// See [`crate::flat_op::FlatOp::RegisterAgentActivity`].
RegisterAgentActivity(OpActivity<<ET as UnitEnum>::Unit, LT>),
/// A link create or delete operation, grouped into [`OpLink`] to mirror the
/// [`OpRecord`]/[`OpEntry`]/[`OpActivity`] sub-types. See
/// [`crate::flat_op::FlatOp::RegisterCreateLink`] /
/// [`crate::flat_op::FlatOp::RegisterDeleteLink`].
RegisterLink(OpLink<LT>),
/// See [`crate::flat_op::FlatOp::RegisterUpdate`].
RegisterUpdate(OpUpdate<ET>),
/// See [`crate::flat_op::FlatOp::RegisterDelete`].
RegisterDelete(OpDelete),
}
/// The link operations of [`FlatOp`], grouped into a sub-type to mirror
/// [`OpRecord`]/[`OpEntry`]/[`OpActivity`].
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OpLink<LT> {
/// A link was created (`ActionData::CreateLink`).
CreateLink {
/// The base address where this link is stored.
base_address: AnyLinkableHash,
/// The target address of this link.
target_address: AnyLinkableHash,
/// The link's tag data.
tag: LinkTag,
/// The app defined link type of this link.
link_type: LT,
/// The v2 action that creates the link (`ActionData::CreateLink`).
action: Action,
},
/// A link was deleted (`ActionData::DeleteLink`).
DeleteLink {
/// The original create-link v2 action (`ActionData::CreateLink`).
original_action: Action,
/// The base address where this link is stored.
base_address: AnyLinkableHash,
/// The target address of the link being deleted.
target_address: AnyLinkableHash,
/// The deleted link's tag data.
tag: LinkTag,
/// The app defined link type of the deleted link.
link_type: LT,
/// The v2 action that deletes the link (`ActionData::DeleteLink`).
action: Action,
},
}