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 MemoryStorageDriver(IStorageDriver): (source)
Constructor: MemoryStorageDriver(base_url)
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 | __all |
Return every explicit and implicit directory path. |
| Method | __build |
Build the public URL for normalized. |
| Method | __digest |
Compute the hex digest of data using algorithm. |
| Method | __entry |
Return the entry stored at normalized or raise when absent. |
| Method | __init__ |
Initialize an empty in-memory disk. |
| Method | __list |
List entries under normalized. |
| Method | __store |
Persist data under normalized, preserving creation time. |
| Async Method | copy |
Copy the file at source to target. |
| Async Method | create |
Create the directory at path, including missing parents. |
| Async Method | delete |
Delete the file at path. |
| Async Method | delete |
Recursively delete the directory at path. |
| Async Method | directories |
List the directory paths contained in the directory at path. |
| Async Method | directory |
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 | last |
Return the last-modification timestamp of the file at path. |
| Async Method | mime |
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 | read |
Stream the contents of the file at path in chunks. |
| Async Method | set |
Change the visibility of the file at path. |
| Async Method | size |
Return the size in bytes of the file at path. |
| Async Method | temporary |
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 | write |
Write the chunks produced by stream to path. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _base |
Undocumented |
| Instance Variable | _directories |
Undocumented |
| Instance Variable | _files |
Undocumented |
Compute the hex digest of data using algorithm.
| Parameters | |
data:bytes | Raw bytes to hash. |
algorithm:str | Any algorithm name accepted by hashlib.new. |
| Returns | |
str | Hexadecimal digest of the data. |
| Raises | |
UnsupportedStorageOperationException | If algorithm is not available. |
Return the entry stored at normalized or raise when absent.
| Parameters | |
normalized:str | Canonical root-relative file path. |
| Returns | |
_MemoryEntry | Stored entry for the path. |
| Raises | |
StorageFileNotFoundException | If no file exists at the path. |
Initialize an empty in-memory disk.
| Parameters | |
basestr | None | Base URL used to build public file URLs, or None when the disk does not expose URLs. |
| Returns | |
None | Undocumented |
Copy the file at path to a location on the local filesystem.
| Parameters | |
path:str | Root-relative file path on the disk. |
destination:str | Path | Local target. When it points to an existing directory the file keeps its original name inside that directory. |
| Returns | |
Path | Absolute local path of the downloaded file. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
Compute the content hash of the file at path.
| Parameters | |
path:str | Root-relative file path. |
algorithm:str | Any algorithm name accepted by hashlib.new. |
| Returns | |
str | Hexadecimal digest of the file contents. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
UnsupportedStorageOperationException | If algorithm is not available. |
Guess the MIME type of the file at path.
| Parameters | |
path:str | Root-relative file path. |
| Returns | |
str | None | MIME type, or None when it cannot be determined. |
Open an asynchronous binary stream for the file at path.
| Parameters | |
path:str | Root-relative file path. |
mode:str | Binary mode: 'rb', 'wb', 'ab', 'rb+', 'wb+', or 'ab+'. |
| Returns | |
AsyncStream | Lazily opened stream; use it as an async context manager. |
| Raises | |
UnsupportedStorageOperationException | If mode is not a supported binary mode. |
str, chunk_size: int = _CHUNK_SIZE) -> AsyncIterator[ bytes]:
(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:str | Root-relative file path. |
expiresint | Lifetime of the URL in seconds. |
| Returns | |
str | Never returned by this driver. |
| Raises | |
UnsupportedStorageOperationException | Always, since memory disks cannot sign URLs. |
str, stream: AsyncIterable[ bytes], visibility: str | None = None):
(source)
¶