Enum holochain_types::dht_op::DhtOp
source · [−]pub enum DhtOp {
StoreElement(Signature, Header, Option<Box<Entry>>),
StoreEntry(Signature, NewEntryHeader, Box<Entry>),
RegisterAgentActivity(Signature, Header),
RegisterUpdatedContent(Signature, Update, Option<Box<Entry>>),
RegisterUpdatedElement(Signature, Update, Option<Box<Entry>>),
RegisterDeletedBy(Signature, Delete),
RegisterDeletedEntryHeader(Signature, Delete),
RegisterAddLink(Signature, CreateLink),
RegisterRemoveLink(Signature, DeleteLink),
}
Expand description
A unit of DHT gossip. Used to notify an authority of new (meta)data to hold as well as changes to the status of already held data.
Variants
StoreElement(Signature, Header, Option<Box<Entry>>)
Used to notify the authority for a header that it has been created.
Conceptually, authorities receiving this DhtOp
do three things:
- Ensure that the element passes validation.
- Store the header into their DHT shard.
- Store the entry into their CAS.
- Note: they do not become responsible for keeping the set of references from that entry up-to-date.
StoreEntry(Signature, NewEntryHeader, Box<Entry>)
Used to notify the authority for an entry that it has been created anew. (The same entry can be created more than once.)
Conceptually, authorities receiving this DhtOp
do four things:
- Ensure that the element passes validation.
- Store the entry into their DHT shard.
- Store the header into their CAS.
- Note: they do not become responsible for keeping the set of references from that header up-to-date.
- Add a “created-by” reference from the entry to the hash of the header.
TODO: document how those “created-by” references are stored in reality.
RegisterAgentActivity(Signature, Header)
Used to notify the authority for an agent’s public key that that agent has committed a new header.
Conceptually, authorities receiving this DhtOp
do three things:
- Ensure that the header alone passes surface-level validation.
- Store the header into their DHT shard.
- FIXME: @artbrock, do they?
- Add an “agent-activity” reference from the public key to the hash of the header.
TODO: document how those “agent-activity” references are stored in reality.
RegisterUpdatedContent(Signature, Update, Option<Box<Entry>>)
Op for updating an entry. This is sent to the entry authority.
RegisterUpdatedElement(Signature, Update, Option<Box<Entry>>)
Op for updating an element. This is sent to the element authority.
RegisterDeletedBy(Signature, Delete)
Op for registering a Header deletion with the Header authority
RegisterDeletedEntryHeader(Signature, Delete)
Op for registering a Header deletion with the Entry authority, so that the Entry can be marked Dead if all of its Headers have been deleted
RegisterAddLink(Signature, CreateLink)
Op for adding a link
RegisterRemoveLink(Signature, DeleteLink)
Op for removing a link
Implementations
sourceimpl DhtOp
impl DhtOp
sourcepub fn signature_mut(&mut self) -> &mut Signature
pub fn signature_mut(&mut self) -> &mut Signature
Mutable access to the Signature
sourcepub fn header_seq_mut(&mut self) -> Option<&mut u32>
pub fn header_seq_mut(&mut self) -> Option<&mut u32>
Mutable access to the seq of the Header, if applicable
sourceimpl DhtOp
impl DhtOp
sourcepub fn dht_basis(&self) -> AnyDhtHash
pub fn dht_basis(&self) -> AnyDhtHash
Returns the basis hash which determines which agents will receive this DhtOp
sourcepub fn to_light(&self) -> DhtOpLight
pub fn to_light(&self) -> DhtOpLight
Convert a DhtOp to a DhtOpLight and basis
sourcepub fn into_inner(self) -> (Signature, Header, Option<Entry>)
pub fn into_inner(self) -> (Signature, Header, Option<Entry>)
Extract inner Signature, Header and Option
sourcepub fn header(&self) -> Header
pub fn header(&self) -> Header
Get the header from this op This requires cloning and converting the header as some ops don’t hold the Header type
sourcepub fn from_type(
op_type: DhtOpType,
header: SignedHeader,
entry: Option<Entry>
) -> DhtOpResult<Self>
pub fn from_type(
op_type: DhtOpType,
header: SignedHeader,
entry: Option<Entry>
) -> DhtOpResult<Self>
From a type, header and an entry (if there is one)
Trait Implementations
sourceimpl<'arbitrary> Arbitrary<'arbitrary> for DhtOp
impl<'arbitrary> Arbitrary<'arbitrary> for DhtOp
sourcefn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of Self
from the entirety of the given unstructured data. Read more
sourceimpl<'de> Deserialize<'de> for DhtOp
impl<'de> Deserialize<'de> for DhtOp
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl HashableContent for DhtOp
impl HashableContent for DhtOp
sourcefn hashable_content(&self) -> HashableContentBytes
fn hashable_content(&self) -> HashableContentBytes
Return a subset of the content, either as SerializedBytes “content”, which will be used to compute the hash, or as an already precomputed hash which will be used directly Read more
sourceimpl TryFrom<&'_ DhtOp> for SerializedBytes
impl TryFrom<&'_ DhtOp> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: &DhtOp) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &DhtOp) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl TryFrom<DhtOp> for SerializedBytes
impl TryFrom<DhtOp> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: DhtOp) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: DhtOp) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl TryFrom<SerializedBytes> for DhtOp
impl TryFrom<SerializedBytes> for DhtOp
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(sb: SerializedBytes) -> Result<DhtOp, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<DhtOp, SerializedBytesError>
Performs the conversion.
impl Eq for DhtOp
impl StructuralEq for DhtOp
impl StructuralPartialEq for DhtOp
Auto Trait Implementations
impl RefUnwindSafe for DhtOp
impl Send for DhtOp
impl Sync for DhtOp
impl Unpin for DhtOp
impl UnwindSafe for DhtOp
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T, C> HashableContentExtSync<T> for C where
T: HashTypeSync,
C: HashableContent<HashType = T>,
impl<T, C> HashableContentExtSync<T> for C where
T: HashTypeSync,
C: HashableContent<HashType = T>,
sourcefn into_hashed(self) -> HoloHashed<C>
fn into_hashed(self) -> HoloHashed<C>
Move into a HoloHashed
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more