Function hdk::entry::update_entry

source ·
pub fn update_entry<I, E>(hash: ActionHash, input: I) -> ExternResult<ActionHash>where
    Entry: TryFrom<I, Error = E>,
    WasmError: From<E>,
Expand description

Update an app entry. Also see update.

The hash is the ActionHash of the deleted record, the input is a TryInto<CreateInput>.

Updates can reference Records which contain Entry data – namely, Creates and other Updates – but not Deletes or system Records.

As updates can reference records on other agent’s source chains across unpredictable network topologies, they are treated as a tree structure.

Many updates can point to a single create/update and continue to accumulate as long as agents author them against that record. It is up to happ developers to decide how to ensure the tree branches are walked appropriately and that updates point to the correct record, whatever that means for the happ.

#[hdk_entry_helper]
pub struct Foo(u32);

#[hdk_entry_defs]
pub enum EntryTypes {
   Foo(Foo)
}

let foo_zero_action_hash: ActionHash = create_entry(EntryTypes::Foo(Foo(0)))?;
let foo_ten_update_action_hash: ActionHash = update_entry(foo_zero_action_hash, EntryTypes::Foo(Foo(10)))?;

@todo in the future this will be true because we will have the concept of ‘redirects’: Works as an app entry delete+create.

See create_entry See update See delete_entry