objectstore.py 764 B

1234567891011121314151617181920212223242526
  1. # -*- coding: utf-8 -*-
  2. r"""源件与产物对象存储接口(**组件接入点:MinIO**)。
  3. 现在:源件在 `data/raw/<场站>/`、产物在 `outputs/<场>/`。
  4. 目标:以**对象键**(`<场站>/<族>/<件名>`)取代绝对路径,后端可换 MinIO。
  5. P0 只立契约,无实现(默认仍是本地目录)。
  6. """
  7. from __future__ import annotations
  8. from abc import ABC, abstractmethod
  9. from typing import Iterator
  10. class ObjectStore(ABC):
  11. @abstractmethod
  12. def put(self, key: str, path) -> str: ...
  13. @abstractmethod
  14. def get(self, key: str, dest) -> str: ...
  15. @abstractmethod
  16. def list(self, prefix: str = '') -> Iterator[str]: ...
  17. @abstractmethod
  18. def stat(self, key: str) -> dict: ...