Orchid.Repo.Transferable behaviour (Orchid v0.6.1)

Copy Markdown View Source

Optional behaviour for bulk export / import of store contents.

Safety note: adapters must implement validate/1 and callers must call it before import/2 when the serialized payload crosses a trust boundary.

Summary

Types

scope()

@type scope() :: :all | {:keys, [Orchid.Repo.key()]} | {:condition, term()}

serialized()

@type serialized() :: binary()

Callbacks

export(store, scope, opts)

@callback export(store :: Orchid.Repo.store_ref(), scope(), opts :: keyword()) ::
  {:ok, serialized()} | {:error, term()}

import store, serialized

@callback import(store :: Orchid.Repo.store_ref(), serialized()) :: :ok | {:error, term()}

validate(serialized)

@callback validate(serialized()) :: :ok | {:error, term()}