Reference implementation of Firkin.Backend — stores credentials,
buckets, objects, and multipart uploads in a named ETS table.
This module exists for three purposes:
Reference — every callback in
Firkin.Backendhas a working implementation here. Read the source if you're unsure how your own backend should shape its return values (Firkin.Object,Firkin.ListResult,Firkin.DeleteResult, etc.).Manual testing — the default backend for
mix firkin.serve, letting you drive Firkin fromawsCLI /mc/ any S3 client without writing a storage layer first.Test double — downstream projects using Firkin-compatible tooling can point their tests at this backend instead of standing up MinIO.
Not for production use. All state lives in a single ETS table and
disappears when the owning BEAM process exits. No concurrency controls
beyond ETS atomicity. No persistence. No quotas. No pagination for
ListObjectsV2, ListMultipartUploads, or ListParts.
Usage
Firkin.Backends.Memory.start()
Firkin.Backends.Memory.add_credential("AKID", "SECRET")
forward "/s3", Firkin.Plug,
backend: Firkin.Backends.Memory,
region: "us-east-1"Implements the streaming variants of put_object_stream/5 and
upload_part_stream/6, so the Plug's :max_buffered_put_bytes cap
is bypassed when this backend is used.
Summary
Functions
Registers an access-key/secret-key credential pair. The identity
stored alongside is %{user: access_key_id} — adequate for demos.
Clears all stored state. Leaves the ETS table in place.
Creates the ETS table if it does not exist and resets all state.
Functions
Registers an access-key/secret-key credential pair. The identity
stored alongside is %{user: access_key_id} — adequate for demos.
@spec reset() :: :ok
Clears all stored state. Leaves the ETS table in place.
@spec start() :: :ok
Creates the ETS table if it does not exist and resets all state.