View Source RemotePersistentTerm.Fetcher behaviour (RemotePersistentTerm v0.3.0)

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

Link to this section Summary

Types

Implementation specific state.

Callbacks

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

Download the term from the remote source.

Initialize the implementation specific state of the Fetcher.

Link to this section Types

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

Implementation specific state.

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

Link to this section Callbacks

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

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

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

Download the term from the remote source.

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

Initialize the implementation specific state of the Fetcher.