amend

abstract suspend fun amend(subscription: SubscriptionId, ref: AggregateRef, amendment: ParkedAmendment): ParkedAggregate?

Changes the retry state of the entry parking ref for subscription as amendment says, in one write, giving it the next revision; a restate (ParkedAmendment.Restate) also changes why it is parked. A claim of an automatic retry (ParkedAmendment.ClaimRetry), a schedule (ParkedAmendment.Schedule), the claim or the take of a request (ParkedAmendment.ClaimRequest, ParkedAmendment.TakeRequest) or a restate applies only at the revision its caller read, so of two nodes that both read it (an owner handing its partition off and the next one) only one claims or takes it, and nothing written since the read is covered.

An operator's amendment (ParkedAmendment.MarkRecoverable, ParkedAmendment.ApplyRetrySpec, ParkedAmendment.Request) that names its parking (its failedAt) applies only while the entry is that parking, checked in the same write: a command delivered again, or sent from what the console showed a while ago, never acts on a later parking of the aggregate.

A ledger names the amendments it has a statement of its own for and applies every other one by its generic path, amendByRevision: it reads the entry, applies the amendment (amended) and writes the result conditioned on the revision it read. Its when over ParkedAmendment ends in else, so an amendment a later version adds reaches a ledger built before it, and is applied as the reference semantics say.

Return

the amended entry; null when the aggregate is not parked or the amendment's condition does not hold.