cadrumo.adapters.persistence.profile._revision_guarded_singleton_mutation module

Revision-guarded mutation mechanics shared by profile singleton kernels.

mutate_revision_guarded_singleton(mutation, *, load_revisioned, write, save, attempts)[source]

Apply a pure singleton mutation, retrying only revision conflicts.

The caller keeps decoding and wire-format-specific write construction at its own boundary. This helper owns only the invariant shared by both singleton kernels: the write asserts the revision that the same attempt loaded.

Return type:

TypeVar(DocumentT)

Parameters:
  • mutation (Callable[[DocumentT], DocumentT])

  • load_revisioned (_RevisionedSingletonLoader)

  • write (_RevisionedSingletonWrite)

  • save (_RevisionedSingletonSave)

  • attempts (int)