Skip to main content

validate_next

Function validate_next 

Source
pub fn validate_next(
    log: &[EventEnvelope],
    candidate: &EventEnvelope,
) -> Result<(), ValidationError>
Expand description

Decides whether candidate is the one legal next event to append to log.

log is assumed well formed (the guard’s own invariant: it is either empty or a prefix built by appending only validated events). The check reads the log’s tail, not its whole history, so it is cheap to run on every append.

§Errors

A ValidationError naming the first rule the candidate breaks. See the variants for the full list; the module docs explain how each maps to a cursor rule.