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

Own tasks and pending client results for exactly one connection.

Method __init__ Bind immutable context and initialize finite connection registries.
Method _cancelTask Deliver at most one cancellation without interrupting cleanup again.
Method _writeDone Release write ownership even when its original caller was cancelled.
Method cancel Schedule one cancellation after an admitted task can enter its finally.
Async Method cleanup Cancel owned work and release every retained task and Future.
Method complete Correlate a completion without retaining duplicate or late messages.
Method finish Release a completed ID while retaining its terminal delivery task.
Method invocationDone Retrieve invocation failures and wake a reader after fatal delivery.
Async Method invoke Invoke one client and release its Future on every exit path.
Async Method send Encode and await delivery of a protocol envelope.
Async Method sendEncoded Await one serialized write without letting RPC cancellation tear it.
Class Variable __slots__ Undocumented
Instance Variable _cancel_requested Undocumented
Instance Variable _counter Undocumented
Instance Variable _write_lock Undocumented
Instance Variable _write_task Undocumented
Instance Variable active Undocumented
Instance Variable closing Undocumented
Instance Variable config Undocumented
Instance Variable context Undocumented
Instance Variable failure Undocumented
Instance Variable finishing Undocumented
Instance Variable hub Undocumented
Instance Variable owner Undocumented
Instance Variable pending Undocumented
Instance Variable protocol Undocumented
Instance Variable ready Undocumented
Instance Variable socket Undocumented
def __init__(self, context: HubContext, hub: type[Hub], protocol: HubProtocol, config: RealtimeConfig): (source)

Bind immutable context and initialize finite connection registries.

Parameters
context:HubContextConnection identity and public socket.
hub:type[Hub]Application-owned Hub type.
protocol:HubProtocolRoute-selected codec.
config:RealtimeConfigInvocation and broadcast limits.
Returns
NoneInitialize owned tasks, pending results and serialized write state.
Raises
RuntimeErrorIf no event loop is running to identify the connection owner.
def _cancelTask(self, task: asyncio.Task[None]): (source)

Deliver at most one cancellation without interrupting cleanup again.

Parameters
task:asyncio.Task[None]Invocation admitted before this event-loop callback was scheduled.
Returns
NoneCancel the task unless it is finishing, done or already cancelling.
def _writeDone(self, task: asyncio.Task[None]): (source)

Release write ownership even when its original caller was cancelled.

Parameters
task:asyncio.Task[None]Completed task for the sole in-flight transport write.
Returns
NoneRelease the write lock and cancel the owner after a failed write.
def cancel(self, invocation_id: str): (source)

Schedule one cancellation after an admitted task can enter its finally.

Parameters
invocation_id:strActive invocation to cancel; unknown IDs are ignored.
Returns
NoneSchedule cancellation once for the selected active invocation.
Raises
RuntimeErrorIf cancellation needs scheduling but no event loop is running.
async def cleanup(self): (source)

Cancel owned work and release every retained task and Future.

Returns
NoneFinish cooperative cancellation before the connection scope exits.
Raises
asyncio.CancelledErrorIf cleanup is cancelled while joining tasks; task registries and owner references are still cleared.
def complete(self, completion: Completion): (source)

Correlate a completion without retaining duplicate or late messages.

Parameters
completion:CompletionValidated client completion.
Returns
NoneResolve the pending result or record a sanitized client error; ignore unknown, duplicate and already completed identifiers.
def finish(self, invocation_id: str): (source)

Release a completed ID while retaining its terminal delivery task.

Parameters
invocation_id:strID belonging to the current invocation task. Admission errors from the connection reader cannot release another invocation's ownership.
Returns
NoneMove the current owned invocation from active to finishing tasks.
Raises
RuntimeErrorIf no event loop is running to identify the current task.
def invocationDone(self, invocation_id: str, task: asyncio.Task[None]): (source)

Retrieve invocation failures and wake a reader after fatal delivery.

Parameters
invocation_id:strIdentifier owned by this task, including cancellation before entry.
task:asyncio.Task[None]Invocation whose local cleanup has already run.
Returns
NoneRelease task ownership and cancel the connection owner on failure.
async def invoke(self, target: str, *args: object, timeout: float | None = None) -> object: (source)

Invoke one client and release its Future on every exit path.

Parameters
target:strExplicit client method name.
*args:objectUp to 64 serializable positional arguments.
timeout:float | None, optionalTotal send/result deadline in seconds. None uses the configured client-result timeout.
Returns
objectClient completion result, including None.
Raises
ConnectionErrorIf the target is not ready or disconnects.
RuntimeErrorIf the pending-result budget is exhausted.
ValueErrorIf the target, argument count, deadline or encoded payload is invalid.
TypeErrorIf the selected codec cannot encode an argument value.
TimeoutErrorIf sending or receiving the completion exceeds the deadline.
ClientInvocationErrorIf the client returns a completion error.
asyncio.CancelledErrorIf the invocation is cancelled; its pending result is released.
async def send(self, envelope: object): (source)

Encode and await delivery of a protocol envelope.

Parameters
envelope:objectSerializable Orionis protocol message.
Returns
NoneEncode the envelope and complete its ordered transport write.
Raises
TypeError, ValueErrorIf the selected codec cannot encode the envelope.
ConnectionErrorIf connection cleanup has started.
asyncio.CancelledErrorIf delivery is cancelled; an already started write stays shielded.
async def sendEncoded(self, data: str | bytes): (source)

Await one serialized write without letting RPC cancellation tear it.

Parameters
data:str | bytesImmutable, already encoded envelope.
Returns
NoneComplete the ordered transport write while preserving backpressure.
Raises
ConnectionErrorIf cleanup has started.
asyncio.CancelledErrorIf the caller is cancelled; an already started write stays shielded until it finishes or connection cleanup cancels it.
__slots__: tuple[str, ...] = (source)

Undocumented

_cancel_requested: set[str] = (source)

Undocumented

_counter: int = (source)

Undocumented

_write_lock = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

protocol = (source)

Undocumented

Undocumented

Undocumented