pub enum Op {
    StoreRecord {
        record: Record,
    },
    StoreEntry {
        action: SignedHashed<EntryCreationAction>,
        entry: Entry,
    },
    RegisterUpdate {
        update: SignedHashed<Update<EntryRateWeight>>,
        new_entry: Entry,
        original_action: EntryCreationAction,
        original_entry: Entry,
    },
    RegisterDelete {
        delete: SignedHashed<Delete<RateWeight>>,
        original_action: EntryCreationAction,
        original_entry: Entry,
    },
    RegisterAgentActivity {
        action: SignedHashed<Action>,
    },
    RegisterCreateLink {
        create_link: SignedHashed<CreateLink<RateWeight>>,
    },
    RegisterDeleteLink {
        delete_link: SignedHashed<DeleteLink>,
        create_link: CreateLink<RateWeight>,
    },
}
Expand description

These are the operational transformations that can be applied to Holochain data. Every Action produces a set of operations. These operations are each sent to an authority for validation.

Producing Operations

The following is a list of the operations that can be produced by each Action:

Authorities

There are three types of authorities in Holochain:

The Action Authority

This set of authorities receives the Op::StoreRecord. This is where you can implement your own logic for checking that it is valid to store any of the Action variants according to your own applications rules.

The Entry Authority

This set of authorities receives the Op::StoreEntry. This is where you can implement your own logic for checking that it is valid to store an Entry. You can think of this as the “Create” from the CRUD acronym.

Metadata

The entry authority is also responsible for storing the metadata for each entry. They receive the Op::RegisterUpdate and Op::RegisterDelete. This is where you can implement your own logic for checking that it is valid to update or delete any of the Entry types defined in your application. You can think of this as the “Update” and “Delete” from the CRUD acronym.

They receive the Op::RegisterCreateLink and Op::RegisterDeleteLink. This is where you can implement your own logic for checking that it is valid to place a link on a base Entry.

The Chain Authority

This set of authorities receives the Op::RegisterAgentActivity. This is where you can implement your own logic for checking that it is valid to add a new Action to an agent source chain. You are not validating the individual record but the entire agents source chain.

Author

When authoring a new Action to your source chain, the validation will be run from the perspective of every authority.

A note on metadata for the Action authority.

Technically speaking the Action authority also receives and validates the Op::RegisterUpdate and Op::RegisterDelete but they run the same callback as the Entry authority because it would be inconsistent to have two separate validation outcomes for these ops.

Running Validation

When the fn validate(op: Op) -> ExternResult<ValidateCallbackResult> is called it will be passed the operation variant for the authority that is actually running the validation.

For example the entry authority will be passed the Op::StoreEntry operation. The operational transforms that can are applied to Holochain data. Operations beginning with Store are concerned with creating and storing data. Operations beginning with Register are concerned with registering metadata about the data.

Variants

StoreRecord

Fields

record: Record

The Record to store.

Stores a new Record in the DHT. This is the act of creating a new Action and publishing it to the DHT. Note that not all Actions contain an Entry.

StoreEntry

Fields

action: SignedHashed<EntryCreationAction>

The signed and hashed EntryCreationAction that creates a new instance of the Entry.

entry: Entry

The new Entry to store.

Stores a new Entry in the DHT. This is the act of creating a either a Action::Create or a Action::Update and publishing it to the DHT. These actions create a new instance of an Entry.

RegisterUpdate

Fields

update: SignedHashed<Update<EntryRateWeight>>

The signed and hashed Action::Update that registers the update.

new_entry: Entry

The new Entry that is being updated to.

original_action: EntryCreationAction

The original EntryCreationAction that created the original Entry. Note that the update points to a specific instance of the of the original Entry.

original_entry: Entry

The original Entry that is being updated from.

Registers an update from an instance of an Entry in the DHT. This is the act of creating a Action::Update and publishing it to the DHT. Note that the Action::Update stores an new instance of an Entry and registers it as an update to the original Entry. This operation is only concerned with registering the update.

RegisterDelete

Fields

delete: SignedHashed<Delete<RateWeight>>

The signed and hashed Action::Delete that registers the deletion.

original_action: EntryCreationAction

The original EntryCreationAction that created the original Entry.

original_entry: Entry

The original Entry that is being deleted.

Registers a deletion of an instance of an Entry in the DHT. This is the act of creating a Action::Delete and publishing it to the DHT.

RegisterAgentActivity

Fields

action: SignedHashed<Action>

The signed and hashed Action that is being registered.

Registers a new Action on an agent source chain. This is the act of creating any Action and publishing it to the DHT.

Fields

create_link: SignedHashed<CreateLink<RateWeight>>

The signed and hashed Action::CreateLink that registers the link.

Registers a link between two Entrys. This is the act of creating a Action::CreateLink and publishing it to the DHT. The authority is the entry authority for the base Entry.

Fields

delete_link: SignedHashed<DeleteLink>

The signed and hashed Action::DeleteLink that registers the deletion.

create_link: CreateLink<RateWeight>

The link that is being deleted.

Deletes a link between two Entrys. This is the act of creating a Action::DeleteLink and publishing it to the DHT. The delete always references a specific Action::CreateLink.

Trait Implementations

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

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

The archived version of the pointer metadata for this type.

Converts some archived metadata to the pointer metadata for itself.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Deserializes using the given deserializer

Returns the argument unchanged.

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 type for metadata in pointers and references to Self.

The resulting type after obtaining ownership.

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

Uses borrowed data to replace owned data, usually by cloning. 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