Skip to content

Class swarmauri_core.storage.IStorageAdapter.IStorageAdapter

swarmauri_core.storage.IStorageAdapter.IStorageAdapter

Bases: ABC

Interface for basic storage adapter operations.

upload abstractmethod

upload(key, data)

Upload data under key and return the resulting URI.

Source code in swarmauri_core/storage/IStorageAdapter.py
11
12
13
14
@abstractmethod
def upload(self, key: str, data: BinaryIO) -> str:  # pragma: no cover - interface
    """Upload *data* under *key* and return the resulting URI."""
    raise NotImplementedError

download abstractmethod

download(key)

Retrieve the artifact stored at key.

Source code in swarmauri_core/storage/IStorageAdapter.py
16
17
18
19
@abstractmethod
def download(self, key: str) -> BinaryIO:  # pragma: no cover - interface
    """Retrieve the artifact stored at *key*."""
    raise NotImplementedError

upload_dir abstractmethod

upload_dir(src, *, prefix='')

Recursively upload files from src under prefix.

Source code in swarmauri_core/storage/IStorageAdapter.py
21
22
23
24
25
26
@abstractmethod
def upload_dir(
    self, src: str | os.PathLike, *, prefix: str = ""
) -> None:  # pragma: no cover - interface
    """Recursively upload files from *src* under *prefix*."""
    raise NotImplementedError

download_dir abstractmethod

download_dir(prefix, dest_dir)

Download all artifacts under prefix into dest_dir.

Source code in swarmauri_core/storage/IStorageAdapter.py
28
29
30
31
32
33
@abstractmethod
def download_dir(
    self, prefix: str, dest_dir: str | os.PathLike
) -> None:  # pragma: no cover - interface
    """Download all artifacts under *prefix* into *dest_dir*."""
    raise NotImplementedError

from_uri abstractmethod classmethod

from_uri(uri)

Create an adapter instance from uri.

Source code in swarmauri_core/storage/IStorageAdapter.py
35
36
37
38
39
@classmethod
@abstractmethod
def from_uri(cls, uri: str) -> "IStorageAdapter":  # pragma: no cover - interface
    """Create an adapter instance from *uri*."""
    raise NotImplementedError