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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
use holochain_integrity_types::{CapClaimEntry, CapGrantEntry};
use super::*;
#[derive(Debug, Clone, PartialEq, Eq)]
/// Data specific to the [`Op::StoreEntry`] operation.
pub enum OpEntry<ET>
where
ET: UnitEnum,
{
/// This operation stores the [`Entry`] for an
/// app defined entry type.
CreateEntry {
/// The app defined entry with the deserialized
/// [`Entry`] data.
app_entry: ET,
/// The [`Create`] action that creates this entry
action: Create,
},
/// This operation stores the [`Entry`] for an
/// [`AgentPubKey`].
CreateAgent {
/// The agent that was created
agent: AgentPubKey,
/// The [`Create`] action that creates this agent's key
action: Create,
},
/// This operation stores the [`Entry`] for the
/// newly created entry in an update.
UpdateEntry {
/// The hash of the [`Action`] that created the original entry
original_action_hash: ActionHash,
/// The hash of the original entry
original_entry_hash: EntryHash,
/// The app defined entry with the deserialized
/// [`Entry`] data of the new entry.
app_entry: ET,
/// The [`Update`] action that updates this entry
action: Update,
},
/// This operation stores the [`Entry`] for an
/// updated [`AgentPubKey`].
UpdateAgent {
/// The new [`AgentPubKey`].
new_key: AgentPubKey,
/// The original [`AgentPubKey`].
original_key: AgentPubKey,
/// The hash of the original keys [`Action`].
original_action_hash: ActionHash,
/// The [`Update`] action that updates this entry
action: Update,
},
/// This operation stores the [`Entry`] for a CapGrant
CreateCapGrant {
/// The cap grant entry data.
entry: CapGrantEntry,
/// The [`Create`] action that creates this cap grant
action: Create,
},
/// This operation stores the [`Entry`] for a CapClaim
CreateCapClaim {
/// The cap claim entry data.
entry: CapClaimEntry,
/// The [`Create`] action that creates this cap claim
action: Create,
},
/// This operation updates the [`Entry`] for a CapGrant
UpdateCapGrant {
/// The hash of the [`Action`] that created the original [`crate::CapGrant`]
original_action_hash: ActionHash,
/// The hash of the original [`crate::CapGrant`]
original_entry_hash: EntryHash,
/// The [`Update`] action that updates the [`crate::CapGrant`]
action: Update,
/// The new entry to store
entry: CapGrantEntry,
},
/// This operation updates the [`Entry`] for a CapClaim
UpdateCapClaim {
/// The hash of the [`Action`] that created the original [`crate::CapClaim`]
original_action_hash: ActionHash,
/// The hash of the original [`crate::CapClaim`]
original_entry_hash: EntryHash,
/// The [`Update`] action that updates the [`crate::CapClaim`]
action: Update,
/// The new entry to store
entry: CapClaimEntry,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
/// Data specific to the [`Op::RegisterUpdate`] operation.
pub enum OpUpdate<ET>
where
ET: UnitEnum,
{
/// This operation registers an update from
/// the original [`Entry`].
Entry {
/// The original [`Create`] or [`Update`] [`Action`].
original_action: EntryCreationAction,
/// The app defined entry type with the deserialized
/// [`Entry`] data of the original entry.
original_app_entry: ET,
/// The app defined entry type with the deserialized
/// [`Entry`] data of the new entry.
app_entry: ET,
/// The action that updates this entry
action: Update,
},
/// This operation registers an update from
/// the original private [`Entry`].
PrivateEntry {
/// The hash of the original original [`Action`].
original_action_hash: ActionHash,
/// The unit version of the app defined entry type
/// for the original entry.
original_app_entry_type: <ET as UnitEnum>::Unit,
/// The unit version of the app defined entry type
/// for the new entry.
app_entry_type: <ET as UnitEnum>::Unit,
/// The action that updates this entry
action: Update,
},
/// This operation registers an update from
/// the original [`AgentPubKey`].
Agent {
/// The new [`AgentPubKey`].
new_key: AgentPubKey,
/// The original [`AgentPubKey`].
original_key: AgentPubKey,
/// The hash of the original original [`Action`].
original_action_hash: ActionHash,
/// The [`Update`] action that updates the agent's key
action: Update,
},
/// This operation registers an update from
/// a Capability Claim.
CapClaim {
/// The hash of the original original [`Action`].
original_action_hash: ActionHash,
/// The [`Update`] action that updates the [`crate::CapClaim`]
action: Update,
},
/// This operation registers an update from
/// a Capability Grant.
CapGrant {
/// The hash of the original original [`Action`].
original_action_hash: ActionHash,
/// The [`Update`] action that updates the [`crate::CapGrant`]
action: Update,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
/// Data specific to the [`Op::RegisterDelete`] operation.
pub enum OpDelete<ET>
where
ET: UnitEnum,
{
/// This operation registers a deletion to the
/// original [`Entry`].
Entry {
/// The entries original [`Create`] or [`Update`] [`Action`].
original_action: EntryCreationAction,
/// The app defined entry type with the deserialized
/// [`Entry`] data from the deleted entry.
original_app_entry: ET,
/// The [`Delete`] action that deletes this entry
action: Delete,
},
/// This operation registers a deletion to the
/// original private [`Entry`].
PrivateEntry {
/// The entries original [`EntryCreationAction`].
original_action: EntryCreationAction,
/// The unit version of the app defined entry type
/// of the deleted entry.
original_app_entry_type: <ET as UnitEnum>::Unit,
/// The [`Delete`] action that deletes this entry
action: Delete,
},
/// This operation registers a deletion to an
/// [`AgentPubKey`].
Agent {
/// The deleted [`AgentPubKey`].
original_key: AgentPubKey,
/// The hash of the deleted keys [`Action`].
original_action: EntryCreationAction,
/// The [`Delete`] action that deletes this entry
action: Delete,
},
/// This operation registers a deletion to a
/// Capability Claim.
CapClaim {
/// The deleted Capability Claim's [`Action`].
original_action: EntryCreationAction,
/// The [`Delete`] action that deletes this entry
action: Delete,
},
/// This operation registers a deletion to a
/// Capability Grant.
CapGrant {
/// The deleted Capability Claim's [`Action`].
original_action: EntryCreationAction,
/// The [`Delete`] action that deletes this entry
action: Delete,
},
}