Skip to main content

rewrite

Function rewrite 

Source
pub fn rewrite(
    (scope, version): (Scope<'_>, u32),
    from: u32,
    migration: &dyn Fn(&mut Doc, u32) -> Result<(), ModelError>,
    doc: &mut Doc,
) -> Result<bool, ModelError>
Expand description

The app’s own rewrite of the record scope names for version, from the version from it stood at, by migration (its #[resource(migrate = ..)]): once, as one housekeeping change after the record’s step to version, made by an actor and at a time derived from the record, its workspace, the version and the heads it starts from, so two holders rewriting the same history make the same change. It is decided as any write of the record’s. A rewrite rewrites by key and never inserts list elements, so two holders rewriting apart converge on one item each. Whether it changed anything.

§Errors

Returns the migration’s error; doc is left as it was.