Aludel.Storage (aludel v0.2.0)

Copy Markdown View Source

Domain-facing facade for document storage backends.

Test case documents are persisted through the configured storage adapter.

Summary

Types

config()

@type config() :: keyword()

error_reason()

@type error_reason() :: term()

Functions

adapter()

@spec adapter() :: module()

backend_name(storage_adapter \\ adapter())

@spec backend_name(module()) :: String.t()

config()

@spec config() :: config()

delete(key, opts \\ [])

@spec delete(
  String.t(),
  keyword()
) :: :ok | {:error, error_reason()}

get(key, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, binary()} | {:error, error_reason()}

put(key, data, content_type)

@spec put(String.t(), binary(), String.t()) ::
  {:ok, String.t()} | {:error, error_reason()}

Persists document contents through the configured adapter and returns the adapter-specific storage key to save with the document row.

read(test_case_document)

@spec read(Aludel.Evals.TestCaseDocument.t()) ::
  {:ok, binary()} | {:error, error_reason()}

resolve_backend(backend)

@spec resolve_backend(String.t() | nil) ::
  {:ok, module()} | {:error, :unknown_storage_backend}

storage_key(document_id, filename)

@spec storage_key(Ecto.UUID.t(), String.t()) :: String.t()