Skip to main content

commit_written

Function commit_written 

Source
pub fn commit_written(
    doc: &mut Doc,
    action: &dyn Action,
    encoded: EncodedAction,
    actor: &[u8],
    context: ActionContext,
    described: Option<Described>,
) -> Result<ActionEnvelope, ActionError>
Expand description

Commit what action already wrote, the doc’s open transaction under actor, as its change recorded with context, and return its replayable envelope: the change apply_local_with_context would have made, without applying it again. described is what the action said it does, read from the document before its first write.

The open transaction must hold the action’s writes and nothing else, written as Action::apply writes them, and the action must record no compensation: a peer replays the action and checks that it makes exactly this change (verify_change).

§Errors

ActionError::Refused when the doc writes as another actor or holds no open writes, or the action is too large to record.