ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

class PolicyRegistry: (source)

Constructor: PolicyRegistry()

View In Hierarchy

Map resource classes to the policy classes protecting them.

Lookups walk the method resolution order once and memoise the result, so an inherited policy costs a single dictionary read after the first request that needed it.

Concurrency

Registration happens during application boot. The lookup cache is a pure function of the registry, so a concurrent first lookup may compute the same value twice without any observable difference.

Method __init__ Initialise an empty registry.
Method bindings Return a copy of the registered resource to policy bindings.
Method policyFor Return the policy protecting a resource class.
Method register Bind a policy class to a resource class.
Class Variable __slots__ Undocumented
Instance Variable __lookup Undocumented
Instance Variable __policies Undocumented
def __init__(self): (source)

Initialise an empty registry.

Returns
NoneThe registry starts without any policy binding.
def bindings(self) -> dict[type, type[IPolicy]]: (source)

Return a copy of the registered resource to policy bindings.

Returns
dict[type, type[IPolicy]]Shallow copy, so callers cannot mutate the registry.
def policyFor(self, resource: type) -> type[IPolicy] | None: (source)

Return the policy protecting a resource class.

Parameters
resource:typeResource class to look a policy up for.
Returns
type[IPolicy] | NoneRegistered policy class, or None when the resource and none of its ancestors declare one.
def register(self, resource: type, policy: type[IPolicy]): (source)

Bind a policy class to a resource class.

Parameters
resource:typeResource class protected by the policy.
policy:type[IPolicy]Policy class implementing the abilities.
Returns
NoneThe binding is stored as a side effect.
Raises
TypeErrorIf either argument is not a class.
__slots__: tuple[str, ...] = (source)

Undocumented

__lookup: dict[type, type[IPolicy] | None] = (source)

Undocumented

__policies: dict[type, type[IPolicy]] = (source)

Undocumented