locus_filesystem_load (locus v2.3.15)

Copy Markdown View Source

Loads a file from the filesystem without blocking the caller.

Summary

Types

event()

event_load_attempt_dismissed()

-type event_load_attempt_dismissed() :: {load_attempt_dismissed, source()}.

event_load_attempt_started()

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

msg()

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

path()

-type path() :: file:filename_all().

source()

-type source() :: {cache | filesystem, path()}.

state()

-opaque state()

success()

-type success() :: #{modified_on := calendar:datetime(), content := binary()}.

Functions

code_change/3

-spec code_change(term(), state(), term()) -> {ok, state()}.

handle_call(Call, From, State)

-spec handle_call(term(), {pid(), reference()}, state()) -> {stop, unexpected_call, state()}.

handle_cast(Cast, State)

-spec handle_cast(term(), state()) -> {stop, unexpected_cast, state()}.

handle_info/2

-spec handle_info(term(), state()) -> {stop, normal, state()} | {stop, unexpected_info, state()}.

init/1

-spec init([InitArg, ...]) -> {ok, state()}
              when
                  InitArg :: OwnerPid | Source | PrevModificationDT,
                  OwnerPid :: pid(),
                  Source :: source(),
                  PrevModificationDT :: calendar:datetime() | unknown.

start_link(Source, PrevModificationDT)

-spec start_link(source(), calendar:datetime() | unknown) -> {ok, pid()}.

terminate(Reason, State)

-spec terminate(term(), state()) -> ok.