cadrumo.application.user_profile.profile_pointer module¶
Reentrant transition authority for the active-profile pointer.
The core record IO owns strict parsing and atomic replacement. This application authority owns the canonical custody-root lock and is consequently the only owner that may advance the durable pointer transition revision.
- exception ActiveProfilePointerTransactionError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorReject invalid nesting or use outside live transaction ownership.
- Parameters:
- Return type:
None
- code¶
- class ActiveProfilePointerTransaction(*, root, owner_pid, owner_thread_id)[source]¶
Bases:
objectPointer observations and transitions under the canonical root lock.
- select(bucket_id)[source]¶
Select
bucket_idand advance once unless it is already selected.- Return type:
- Parameters:
bucket_id (str)
- compare_and_select(*, expected, bucket_id)[source]¶
Select only when the exact observed record remains current.
- Return type:
- Parameters:
expected (BucketPointer)
bucket_id (str)
- compare_and_restore(*, expected, captured)[source]¶
Restore a prior selection without ever restoring its old revision.
- Return type:
- Parameters:
expected (BucketPointer)
captured (BucketPointer)
- active_profile_pointer_transaction(root=None, *, root_lock=None)[source]¶
Acquire or re-enter the active-profile pointer transaction.
Re-entry is valid only for the same canonical root, process, and thread. Nested use for another root and inherited ownership after
forkfail closed. The outermost call waits only for the bounded timeout enforced byprofile_custody_local_lock().- Parameters:
root (
Path|None) – Local storage root. The configured root is used when omitted.root_lock (
ProfileCustodyRootLockPort|None) – Optional application-owned lock provider for dependency injection; the public custody provider is used by default.
- Yields:
The same
ActiveProfilePointerTransactionobject for every valid nested acquisition.- Raises:
ActiveProfilePointerTransactionError – If nested ownership targets a different root or was inherited from another process.
LockAcquisitionError – If the custody root sidecar remains contended until the configured lock timeout expires.
- Return type:
- observe_active_profile_pointer(root=None)[source]¶
Return one lock-scoped public pointer observation.
Purpose-specific application readers use this facade instead of opening a parallel core read path; core bootstrap remains the sole inner-layer exception because it cannot depend outward on this application owner.
- Return type:
- Parameters:
root (Path | None)