# `AgentSessionManager.Ports.ArtifactStore`
[🔗](https://github.com/nshkrdotcom/agent_session_manager/blob/v0.8.0/lib/agent_session_manager/ports/artifact_store.ex#L1)

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")

# `key`

```elixir
@type key() :: String.t()
```

# `store`

```elixir
@type store() :: GenServer.server() | pid() | atom()
```

# `delete`

```elixir
@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

- `:ok` on success
- `{:error, Error.t()}` on failure

# `get`

```elixir
@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

# `put`

```elixir
@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

- `:ok` on success
- `{:error, Error.t()}` on failure

# `delete`

```elixir
@spec delete(store(), key(), keyword()) ::
  :ok | {:error, AgentSessionManager.Core.Error.t()}
```

Deletes the artifact stored under the given key.

# `get`

```elixir
@spec get(store(), key(), keyword()) ::
  {:ok, binary()} | {:error, AgentSessionManager.Core.Error.t()}
```

Retrieves binary data stored under the given key.

# `put`

```elixir
@spec put(store(), key(), iodata(), keyword()) ::
  :ok | {:error, AgentSessionManager.Core.Error.t()}
```

Stores binary data under the given key.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
