cadrumo.domain.calculations.registry.authority_cache module¶
Bounded concurrent retention for immutable authority components.
- retained_object_size(value)[source]¶
Estimate a decoded immutable graph without following types or callables.
Every reachable object is counted once by identity; the walk is iterative because a large revision component reaches millions of members.
- exception AuthorityCacheCycleError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorA component loader recursively requested a key already on its stack.
- Parameters:
- Return type:
None
- code¶
- class RetainedAuthorityValue(value, exclusive_weight, shared_weights=())[source]¶
Bases:
GenericLoaded value and the retained bytes it contributes to the shared budget.
- class AuthorityCacheTelemetry(budget, retained_weight, entries, in_flight)[source]¶
Bases:
objectAccounted retention state, distinct from process RSS and active leases.
- class AccountedAuthorityCache(budget=67108864)[source]¶
Bases:
GenericCoalesce loads and retain successful immutable values within one LRU budget.
- Parameters:
budget (int)
- get_or_load(key, loader)[source]¶
Return a retained value or share exactly one concurrent load for
key.- Return type:
V
- Parameters:
key (K)
loader (Callable[[], RetainedAuthorityValue[V]])
- discard(key)[source]¶
Stop retaining a key without affecting values already held by callers.
- Return type:
None
- Parameters:
key (K)
- clear()[source]¶
Drop retained cache ownership; active loads and caller values remain valid.
- Return type: