Buckets.Adapter behaviour (buckets v1.0.0-rc.1)

Summary

Callbacks

Link to this callback

child_spec(config, cloud_module)

(optional)
@callback child_spec(config :: Keyword.t(), cloud_module :: module()) ::
  Supervisor.child_spec() | {:error, term()}

Returns a child specification for processes this adapter needs, if any.

This callback is optional. Adapters that need supervised processes (like GCS auth servers) should implement this callback. Adapters that don't need any supervised processes (like Volume, S3) can omit this callback entirely.

When implemented, should return:

  • child_spec() - A supervisor child specification
  • {:error, reason} - Config is invalid

Examples:

  • GCS adapter implements this to return auth server child spec
  • Volume/S3 adapters don't implement this callback at all
Link to this callback

delete(binary, t)

@callback delete(binary(), Keyword.t()) :: {:ok, map()} | {:error, term()}
@callback get(binary(), Keyword.t()) :: {:ok, binary()} | {:error, term()}
Link to this callback

put(t, binary, t)

@callback put(Buckets.Object.t(), binary(), Keyword.t()) ::
  {:ok, map()} | {:error, term()}
@callback url(binary(), Keyword.t()) :: {:ok, Buckets.SignedURL.t()}
Link to this callback

validate_config(t)

@callback validate_config(Keyword.t()) :: {:ok, Keyword.t()} | {:error, term()}

Functions

Link to this function

validate_required(config, required)

@spec validate_required(Keyword.t(), list()) :: {:ok, Keyword.t()} | {:error, list()}