pub enum DhtOp {
    StoreElement(SignatureHeaderOption<Box<Entry>>),
    StoreEntry(SignatureNewEntryHeaderBox<Entry>),
    RegisterAgentActivity(SignatureHeader),
    RegisterUpdatedContent(SignatureUpdateOption<Box<Entry>>),
    RegisterUpdatedElement(SignatureUpdateOption<Box<Entry>>),
    RegisterDeletedBy(SignatureDelete),
    RegisterDeletedEntryHeader(SignatureDelete),
    RegisterAddLink(SignatureCreateLink),
    RegisterRemoveLink(SignatureDeleteLink),
}
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(SignatureHeaderOption<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(SignatureNewEntryHeaderBox<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(SignatureHeader)

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(SignatureUpdateOption<Box<Entry>>)

Op for updating an entry. This is sent to the entry authority.

RegisterUpdatedElement(SignatureUpdateOption<Box<Entry>>)

Op for updating an element. This is sent to the element authority.

RegisterDeletedBy(SignatureDelete)

Op for registering a Header deletion with the Header authority

RegisterDeletedEntryHeader(SignatureDelete)

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

Op for adding a link

Op for removing a link

Implementations

Mutable access to the Signature

Mutable access to the seq of the Header, if applicable

source

pub fn header_entry_data_mut(
    &mut self
) -> Option<(&mut EntryHash, &mut EntryType)>

Mutable access to the entry data of the Header, if applicable

Returns the basis hash which determines which agents will receive this DhtOp

Convert a DhtOp to a DhtOpLight and basis

Get the signature for this op

Extract inner Signature, Header and Option from an op

Get the header from this op This requires cloning and converting the header as some ops don’t hold the Header type

Get the entry from this op, if one exists

Get the type as a unit enum, for Display purposes

From a type, header and an entry (if there is one)

Trait Implementations

Generate an arbitrary value of Self from the given unstructured data. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

The HashType which this content will be hashed to

The HashType which this content will be hashed to

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Construct a HoloHash from a reference

Move into a HoloHashed

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more