Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AMAP ML SkillClaw Storage Abstraction

From Leeroopedia
Knowledge Sources
Domains Object_Storage, Infrastructure
Last Updated 2026-10-22 00:00 GMT

Overview

A storage abstraction pattern that unifies local filesystem, S3, and OSS object storage behind a single interface, enabling backend-agnostic data access throughout the application.

Description

Storage abstraction addresses the problem of supporting multiple storage backends without coupling application code to specific SDKs. The SkillClaw pattern defines a common interface (`put_object`, `get_object`, `delete_object`, `iter_objects`) and provides three implementations: `LocalObjectStore` (filesystem), `S3ObjectStore` (boto3), and `OSSObjectStore` (oss2). A factory function (`build_object_store`) selects the backend from configuration. All higher-level components (SkillHub, EvolveServer, ValidationStore) use this abstraction, allowing the same code to run against local development storage or production cloud storage.

Usage

Use this principle when designing systems that need:

  • Multi-backend storage support (local, S3, OSS)
  • Environment-agnostic data access
  • Factory pattern for backend selection
  • Consistent interface across heterogeneous storage systems

Theoretical Basis

The abstraction follows the hexagonal architecture (ports and adapters) pattern:

# Abstract algorithm (NOT real implementation)
class ObjectStore(ABC):
    @abstractmethod
    def put_object(self, key: str, data: bytes) -> None: ...
    @abstractmethod
    def get_object(self, key: str) -> BinaryIO: ...
    @abstractmethod
    def delete_object(self, key: str) -> None: ...
    @abstractmethod
    def iter_objects(self, prefix: str) -> Iterator: ...

def build_object_store(backend, **kwargs) -> ObjectStore:
    if backend == "local":
        return LocalObjectStore(kwargs["local_root"])
    elif backend == "s3":
        return S3ObjectStore(kwargs["bucket"], kwargs["access_key_id"], ...)
    elif backend == "oss":
        return OSSObjectStore(kwargs["endpoint"], kwargs["bucket"], ...)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment