View Source locus_custom_fetcher behaviour (locus v2.3.6)

Callbacks for providing your own database fetcher

Link to this section Summary

Link to this section Types

Specs

description() :: #{database_is_stored_remotely := boolean(), database_is_fetched_from := term()}.

Specs

Link to this type

event_load_attempt_dismissed/0

View Source

Specs

event_load_attempt_dismissed() :: {load_attempt_dismissed, source()}.
Link to this type

event_load_attempt_started/0

View Source

Specs

event_load_attempt_started() :: {load_attempt_started, source()}.

Specs

msg() ::
    {event, event()} |
    {finished, {success, success()}} |
    {finished, dismissed} |
    {finished, {error, term()}}.

Specs

source() :: {local | remote, {custom, term()}}.

Specs

state() :: #state{}.

Specs

success() ::
    #{format := locus_loader:blob_format(),
      content := binary(),
      metadata := successful_fetch_metadata()}.
Link to this type

successful_fetch_metadata/0

View Source

Specs

successful_fetch_metadata() ::
    #{fetched_from := term(), modified_on := calendar:datetime() | unknown}.

Link to this section Callbacks

Specs

conditionally_fetch(Args, {depending_on, PreviousFetchMetadata}) ->
                       {fetched, Success} | dismissed | {error, Reason}
                       when
                           Args :: term(),
                           PreviousFetchMetadata :: successful_fetch_metadata(),
                           Success :: success(),
                           Reason :: term().

Specs

description(Args) -> description() when Args :: term().

Specs

fetch(Args) -> {fetched, Success} | {error, Reason}
         when Args :: term(), Success :: success(), Reason :: term().