Add public repository interfaces and subclassable adapter CRUD API.
Define split JSON and object repository ABCs, promote adapter methods to public CRUD, add example domain repositories, modernize interface stubs, and make the package installable for tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f4280f15c1
commit
e98fd3b90d
@@ -0,0 +1,33 @@
|
||||
"""Definition of ObjectRepositoryInterface abstract base class."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from io import BytesIO
|
||||
|
||||
|
||||
class ObjectRepositoryInterface(ABC):
|
||||
"""Interface that defines binary object CRUD methods."""
|
||||
|
||||
@abstractmethod
|
||||
def get(self, object_name: str) -> BytesIO | None:
|
||||
"""Get an object by name."""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def put(
|
||||
self,
|
||||
object_name: str,
|
||||
data: BytesIO,
|
||||
content_type: str = "application/octet-stream",
|
||||
) -> None:
|
||||
"""Put an object by name."""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def delete(self, object_name: str) -> None:
|
||||
"""Delete an object by name."""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def list_objects(self, prefix: str = "") -> list[str]:
|
||||
"""List object names with an optional prefix."""
|
||||
...
|
||||
Reference in New Issue
Block a user