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.

module documentation

Provide storage operations.

Includes read_chunks, iterate_chunks, spool_stream.

Async Function _close_buffer Drain one owned resource close without replacing an active failure.
Async Function iterate_chunks Batch SDK iterator advances with bounded read-ahead and deterministic close.
Async Function read_chunks Read bounded batches while preserving logical chunks and first-byte latency.
Async Function spool_stream Buffer an async upload once for the cloud drivers.
Constant READ_BUFFER_SIZE Read buffer size used by buffering.
async def _close_buffer(close: Callable[[], object], primary: BaseException | None): (source)

Drain one owned resource close without replacing an active failure.

Parameters
close:collections.abc.CallableSynchronous close callback for an owned handle or SDK iterator.
primary:BaseException or NoneError already propagating from the stream, including control signals.
Returns
NoneNo return value.
Raises
ExceptionIf cleanup fails without an earlier stream failure.
asyncio.CancelledErrorIf the caller is cancelled, after the close completes.
async def iterate_chunks(opener: Callable[[], Iterator[bytes]]) -> AsyncIterator[bytes]: (source)

Batch SDK iterator advances with bounded read-ahead and deterministic close.

Parameters
opener:collections.abc.Callable[[], collections.abc.Iterator[bytes]]Synchronous factory for a request-owned SDK iterator.
Yields
bytesOriginal SDK chunks. A batch holds at most sixteen chunks and stops when it reaches 1 MiB, so memory is bounded by 1 MiB plus one SDK chunk. A cleanup failure does not replace the iterator's original failure.
async def read_chunks(opener: Callable[[], BinaryIO], chunk_size: int, *, buffer_size: int = READ_BUFFER_SIZE) -> AsyncIterator[bytes]: (source)

Read bounded batches while preserving logical chunks and first-byte latency.

Parameters
opener:collections.abc.Callable[[], typing.BinaryIO]Factory for a handle owned exclusively by this iterator.
chunk_size:intMaximum bytes yielded per logical chunk.
buffer_size:intRead-ahead budget, rounded down to a whole number of logical chunks. At least one chunk is read. No producer runs while the consumer pauses.
Yields
bytesFile content in order. Cancellation drains the current read before close. Cleanup failures are observed separately when a read already failed.
async def spool_stream(stream: AsyncIterable[bytes], *, max_size: int) -> BinaryIO: (source)

Buffer an async upload once for the cloud drivers.

Notes

Cancellation drains native opening, writing, and seeking before cleanup. Cleanup failures do not replace the producer or buffer failure.

Parameters
stream:collections.abc.AsyncIterable[bytes]Asynchronous byte-chunk producer.
max_size:intPositive maximum in-memory bytes before the buffer spills to disk.
Returns
typing.BinaryIORewound temporary buffer owned and closed by the uploading driver.
Raises
ValueErrorIf max_size is not a positive integer or is a boolean.
READ_BUFFER_SIZE = (source)

Read buffer size used by buffering.

Value
1024 * 1024