Cotal TypeScript packages
    Preparing search index...

    Function commitFork

    • Copy the cut into the child, and only then create the child's record.

      THE ORDER IS THE DURABILITY ARGUMENT. A crash between the two writes is the case this has to be right for, and writing the spec first would leave a child that has a record and half a history — which driveRun would happily take over, replaying a prefix that stops in the middle of the parent's past and then performing effects from there. Written last, a crash leaves journal entries under an id with no record: driveRun refuses a run it cannot read a record for, and startRun refuses a run whose journal already has records. Neither entry point will touch it, which is the failure a partial fork should have.

      The entries are rewritten onto the child's run id as they are copied. That is not bookkeeping: a journal takes only its own run's entries, and the prefix is now the CHILD's history — the parent's copy stays exactly where it was, because fork is not rollback.

      Parameters

      Returns Promise<ForkCommitResult>