# `Condukt.SessionStore.ObjectStore.Bucket`
[🔗](https://github.com/tuist/tuist/blob/condukt@3.0.0/condukt/lib/condukt/session_store/object_store/bucket.ex#L1)

The object storage `Condukt.SessionStore.ObjectStore` writes to.

A bucket is passed as `{module, config}`. Condukt ships
`Condukt.SessionStore.ObjectStore.S3`, for S3 and services compatible with
it such as Tigris, R2, and MinIO, and `Condukt.SessionStore.ObjectStore.Memory`
for tests.

The store only ever creates objects, and relies on a create failing when the
key already exists: that is how a writer that lost its session finds out.
A bucket must therefore make `create/3` atomic, as S3 does for a `PutObject`
with `If-None-Match: *`, and `list/3` must see every object whose create
has returned.

# `create`

```elixir
@callback create(term(), key :: String.t(), body :: binary()) ::
  :ok | {:error, :exists} | {:error, term()}
```

Creates the object, or returns `{:error, :exists}` when the key already has one.

# `delete`

```elixir
@callback delete(term(), key :: String.t()) :: :ok | {:error, term()}
```

Deletes the object, succeeding when there is none.

# `get`

```elixir
@callback get(term(), key :: String.t()) ::
  {:ok, binary()} | :not_found | {:error, term()}
```

# `list`

```elixir
@callback list(term(), prefix :: String.t(), start_after :: String.t() | nil) ::
  {:ok, [String.t()]} | {:error, term()}
```

Every key under `prefix` that sorts after `start_after`, in ascending order.

---

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