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

Storage driver keeping every object in process memory.

Designed for testing and ephemeral workloads: it implements the full driver contract over plain dictionaries, enabling fakes such as a future Storage.fake() without touching the rest of the component. Directories exist implicitly through file prefixes and explicitly through createDirectory.

Concurrency

The store is a plain dictionary mutated without locks. Every operation completes without awaiting midway, so concurrent tasks on a single event loop never observe a partial mutation. No guarantee is offered when the same path is mutated from several threads at once, which streams opened with open do because they flush their buffer on a worker thread.

Static Method __ancestors Return every ancestor prefix of path.
Method __allDirectories Return every explicit and implicit directory path.
Method __buildUrl Build the public URL for normalized.
Method __digest Compute the hex digest of data using algorithm.
Method __entryOrFail Return the entry stored at normalized or raise when absent.
Method __init__ Initialize an empty in-memory disk.
Method __listSync List entries under normalized.
Method __storeSync Persist data under normalized, preserving creation time.
Async Method copy Copy the file at source to target.
Async Method createDirectory Create the directory at path, including missing parents.
Async Method delete Delete the file at path.
Async Method deleteDirectory Recursively delete the directory at path.
Async Method directories List the directory paths contained in the directory at path.
Async Method directoryExists Check whether a directory exists at path.
Async Method download Copy the file at path to a location on the local filesystem.
Async Method exists Check whether a file exists at path.
Async Method files List the file paths contained in the directory at path.
Async Method hash Compute the content hash of the file at path.
Async Method info Collect a metadata snapshot for the file at path.
Async Method lastModified Return the last-modification timestamp of the file at path.
Async Method mimeType Guess the MIME type of the file at path.
Async Method move Move the file at source to target.
Method open Open an asynchronous binary stream for the file at path.
Async Method read Read the full contents of the file at path.
Async Method readStream Stream the contents of the file at path in chunks.
Async Method setVisibility Change the visibility of the file at path.
Async Method size Return the size in bytes of the file at path.
Async Method temporaryUrl Build a signed, time-limited URL for the file at path.
Async Method url Build the public URL for the file at path.
Async Method visibility Return the visibility of the file at path.
Async Method write Write contents to path, replacing any existing file.
Async Method writeStream Write the chunks produced by stream to path.
Class Variable __slots__ Undocumented
Instance Variable _base_url Undocumented
Instance Variable _directories Undocumented
Instance Variable _files Undocumented
def __ancestors(path: str) -> set[str]: (source)

Return every ancestor prefix of path.

Parameters
path:strCanonical root-relative path.
Returns
set[str]Ancestor directory prefixes, excluding the path itself.
def __allDirectories(self) -> set[str]: (source)

Return every explicit and implicit directory path.

Returns
set[str]Union of explicitly created directories and the ancestor prefixes implied by stored file paths.
def __buildUrl(self, normalized: str) -> str: (source)

Build the public URL for normalized.

Parameters
normalized:strCanonical root-relative file path.
Returns
strURL composed from the configured base URL.
def __digest(self, data: bytes, algorithm: str) -> str: (source)

Compute the hex digest of data using algorithm.

Parameters
data:bytesRaw bytes to hash.
algorithm:strAny algorithm name accepted by hashlib.new.
Returns
strHexadecimal digest of the data.
Raises
UnsupportedStorageOperationExceptionIf algorithm is not available.
def __entryOrFail(self, normalized: str) -> _MemoryEntry: (source)

Return the entry stored at normalized or raise when absent.

Parameters
normalized:strCanonical root-relative file path.
Returns
_MemoryEntryStored entry for the path.
Raises
StorageFileNotFoundExceptionIf no file exists at the path.
def __init__(self, base_url: str | None = None): (source)

Initialize an empty in-memory disk.

Parameters
base_url:str | NoneBase URL used to build public file URLs, or None when the disk does not expose URLs.
Returns
NoneUndocumented
def __listSync(self, normalized: str, *, recursive: bool, want_dirs: bool) -> list[str]: (source)

List entries under normalized.

Parameters
normalized:strCanonical root-relative directory path.
recursive:boolWhen True, traverse the whole subtree.
want_dirs:boolWhen True, collect directories; otherwise files.
Returns
list[str]Sorted root-relative entry paths.
def __storeSync(self, normalized: str, data: bytes, visibility: str | None): (source)

Persist data under normalized, preserving creation time.

Parameters
normalized:strCanonical root-relative file path.
data:bytesRaw bytes to persist.
visibility:str | NoneVisibility to apply, or None to keep the current one.
Returns
NoneUndocumented
async def copy(self, source: str, target: str): (source)

Copy the file at source to target.

Parameters
source:strRoot-relative path of the existing file.
target:strRoot-relative destination path.
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the source file does not exist.
async def createDirectory(self, path: str): (source)

Create the directory at path, including missing parents.

Parameters
path:strRoot-relative directory path.
Returns
NoneUndocumented
async def delete(self, path: str) -> bool: (source)

Delete the file at path.

Parameters
path:strRoot-relative file path.
Returns
boolTrue if the file existed and was removed.
async def deleteDirectory(self, path: str) -> bool: (source)

Recursively delete the directory at path.

Parameters
path:strRoot-relative directory path.
Returns
boolTrue if the directory existed and was removed.
async def directories(self, path: str = '', *, recursive: bool = False) -> list[str]: (source)

List the directory paths contained in the directory at path.

Parameters
path:strRoot-relative directory path. Empty string for the root.
recursive:boolWhen True, include all nested directories.
Returns
list[str]Sorted root-relative directory paths.
async def directoryExists(self, path: str) -> bool: (source)

Check whether a directory exists at path.

Parameters
path:strRoot-relative directory path. The empty string denotes the disk root.
Returns
boolTrue if a directory exists at the given path.
async def download(self, path: str, destination: str | Path) -> Path: (source)

Copy the file at path to a location on the local filesystem.

Parameters
path:strRoot-relative file path on the disk.
destination:str | PathLocal target. When it points to an existing directory the file keeps its original name inside that directory.
Returns
PathAbsolute local path of the downloaded file.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def exists(self, path: str) -> bool: (source)

Check whether a file exists at path.

Parameters
path:strRoot-relative file path.
Returns
boolTrue if a file exists at the given path.
async def files(self, path: str = '', *, recursive: bool = False) -> list[str]: (source)

List the file paths contained in the directory at path.

Parameters
path:strRoot-relative directory path. Empty string for the root.
recursive:boolWhen True, include files from all nested directories.
Returns
list[str]Sorted root-relative file paths.
async def hash(self, path: str, algorithm: str = 'sha256') -> str: (source)

Compute the content hash of the file at path.

Parameters
path:strRoot-relative file path.
algorithm:strAny algorithm name accepted by hashlib.new.
Returns
strHexadecimal digest of the file contents.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
UnsupportedStorageOperationExceptionIf algorithm is not available.
async def info(self, path: str) -> FileInfo: (source)

Collect a metadata snapshot for the file at path.

Parameters
path:strRoot-relative file path.
Returns
FileInfoImmutable entity with size, MIME type, timestamps, hashes, visibility, and URL when available.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def lastModified(self, path: str) -> datetime: (source)

Return the last-modification timestamp of the file at path.

Parameters
path:strRoot-relative file path.
Returns
datetimeTimezone-aware modification timestamp (UTC).
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def mimeType(self, path: str) -> str | None: (source)

Guess the MIME type of the file at path.

Parameters
path:strRoot-relative file path.
Returns
str | NoneMIME type, or None when it cannot be determined.
async def move(self, source: str, target: str): (source)

Move the file at source to target.

Parameters
source:strRoot-relative path of the existing file.
target:strRoot-relative destination path.
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the source file does not exist.
def open(self, path: str, mode: str = 'rb') -> AsyncStream: (source)

Open an asynchronous binary stream for the file at path.

Parameters
path:strRoot-relative file path.
mode:strBinary mode: 'rb', 'wb', 'ab', 'rb+', 'wb+', or 'ab+'.
Returns
AsyncStreamLazily opened stream; use it as an async context manager.
Raises
UnsupportedStorageOperationExceptionIf mode is not a supported binary mode.
async def read(self, path: str) -> bytes: (source)

Read the full contents of the file at path.

Parameters
path:strRoot-relative file path.
Returns
bytesComplete file contents.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def readStream(self, path: str, chunk_size: int = _CHUNK_SIZE) -> AsyncIterator[bytes]: (source)

Stream the contents of the file at path in chunks.

Parameters
path:strRoot-relative file path.
chunk_size:intMaximum number of bytes per yielded chunk.
Returns
AsyncIterator[bytes]Undocumented
Yields
bytesConsecutive chunks of the file contents.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def setVisibility(self, path: str, visibility: str): (source)

Change the visibility of the file at path.

Parameters
path:strRoot-relative file path.
visibility:strTarget visibility ('public' or 'private').
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the file does not exist.
UnsupportedStorageOperationExceptionIf visibility is not a supported level.
async def size(self, path: str) -> int: (source)

Return the size in bytes of the file at path.

Parameters
path:strRoot-relative file path.
Returns
intFile size in bytes.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def temporaryUrl(self, path: str, expires_in: int) -> str: (source)

Build a signed, time-limited URL for the file at path.

The memory driver cannot sign URLs, so this operation always fails.

Parameters
path:strRoot-relative file path.
expires_in:intLifetime of the URL in seconds.
Returns
strNever returned by this driver.
Raises
UnsupportedStorageOperationExceptionAlways, since memory disks cannot sign URLs.
async def url(self, path: str) -> str: (source)

Build the public URL for the file at path.

Parameters
path:strRoot-relative file path.
Returns
strPublicly accessible URL for the file.
Raises
UnsupportedStorageOperationExceptionIf the disk has no base URL configured.
async def visibility(self, path: str) -> str: (source)

Return the visibility of the file at path.

Parameters
path:strRoot-relative file path.
Returns
str'public' or 'private'.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def write(self, path: str, contents: bytes | str, visibility: str | None = None): (source)

Write contents to path, replacing any existing file.

Parameters
path:strRoot-relative file path.
contents:bytes | strData to persist. Strings are encoded as UTF-8.
visibility:str | NoneVisibility to apply, or None to keep the current one.
Returns
NoneUndocumented
async def writeStream(self, path: str, stream: AsyncIterable[bytes], visibility: str | None = None): (source)

Write the chunks produced by stream to path.

Parameters
path:strRoot-relative file path.
stream:AsyncIterable[bytes]Asynchronous byte-chunk producer.
visibility:str | NoneVisibility to apply, or None to keep the current one.
Returns
NoneUndocumented
_base_url: str | None = (source)

Undocumented

_directories: set[str] = (source)

Undocumented

_files: dict[str, _MemoryEntry] = (source)

Undocumented