AgentSessionManager.Ports.ArtifactStore behaviour
(AgentSessionManager v0.8.0)
Copy Markdown
View Source
Port (interface) for storing large blobs (patches, snapshot manifests).
This behaviour defines the contract for artifact storage backends. Artifacts are referenced by string keys and contain binary data.
Design Principles
- Key-value semantics: Simple put/get/delete by string key
- Binary payloads: Artifacts are opaque binary data
- Idempotent writes: Putting the same key twice overwrites safely
- Pluggable backends: File-based, S3, etc.
Usage
{:ok, store} = FileArtifactStore.start_link(root: "/tmp/artifacts")
:ok = ArtifactStore.put(store, "patch-abc123", patch_data)
{:ok, data} = ArtifactStore.get(store, "patch-abc123")
:ok = ArtifactStore.delete(store, "patch-abc123")
Summary
Callbacks
Deletes the artifact stored under the given key.
Retrieves binary data stored under the given key.
Stores binary data under the given key.
Functions
Deletes the artifact stored under the given key.
Retrieves binary data stored under the given key.
Stores binary data under the given key.
Types
@type key() :: String.t()
@type store() :: GenServer.server() | pid() | atom()
Callbacks
@callback delete(store(), key(), keyword()) :: :ok | {:error, AgentSessionManager.Core.Error.t()}
Deletes the artifact stored under the given key.
Idempotent - deleting a non-existent key returns :ok.
Returns
:okon success{:error, Error.t()}on failure
@callback get(store(), key(), keyword()) :: {:ok, binary()} | {:error, AgentSessionManager.Core.Error.t()}
Retrieves binary data stored under the given key.
Returns
{:ok, binary()}on success{:error, Error.t()}when key not found or read fails
@callback put(store(), key(), iodata(), keyword()) :: :ok | {:error, AgentSessionManager.Core.Error.t()}
Stores binary data under the given key.
Overwrites any existing data for the same key.
Returns
:okon success{:error, Error.t()}on failure
Functions
@spec delete(store(), key(), keyword()) :: :ok | {:error, AgentSessionManager.Core.Error.t()}
Deletes the artifact stored under the given key.
@spec get(store(), key(), keyword()) :: {:ok, binary()} | {:error, AgentSessionManager.Core.Error.t()}
Retrieves binary data stored under the given key.
@spec put(store(), key(), iodata(), keyword()) :: :ok | {:error, AgentSessionManager.Core.Error.t()}
Stores binary data under the given key.