RemotePersistentTerm.Fetcher behaviour (RemotePersistentTerm v0.10.0)

View Source

A generic behaviour for a Fetcher module which is responsible for checking the latest version available in the remote source and downloading it.

Summary

Types

Implementation specific state.

Callbacks

Check the current version of the remote term. Used to avoid downloading the same term multiple times.

Download the term from the remote source.

Initialize the implementation specific state of the Fetcher.

Types

opts()

@type opts() :: Keyword.t()

state()

@type state() :: term()

Implementation specific state.

version()

@type version() :: String.t()

Callbacks

current_version(state)

@callback current_version(state()) :: {:ok, version()} | {:error, term()}

Check the current version of the remote term. Used to avoid downloading the same term multiple times.

download(state)

@callback download(state()) :: {:ok, term()} | {:error, term()}

Download the term from the remote source.

init(opts)

@callback init(opts()) :: {:ok, state()} | {:error, term()}

Initialize the implementation specific state of the Fetcher.