View Source grisp_updater_source behaviour (grisp_updater v2.1.1)

Summary

Callbacks

source_cancel/3

-callback source_cancel(State :: term(), SourceRef :: term(), StreamRef :: term()) -> State :: term().

source_close/2

-callback source_close(State :: term(), SourceRef :: term()) -> State :: term().

source_handle/2

(optional)
-callback source_handle(State :: term(), Msg :: term()) ->
                           pass |
                           {ok, State :: term} |
                           {data, StreamRef :: term(), Data :: binary(), State :: term()} |
                           {done, StreamRef :: term(), Data :: binary(), State :: term()} |
                           {stream_error, [StreamRef :: term()], Reason :: term(), State :: term()} |
                           {source_error, SourceRef :: term(), Reason :: term(), State :: term()}.

source_init/1

-callback source_init(Opts :: map()) -> {ok, State :: term()} | {error, term()}.

source_open/3

-callback source_open(State :: term(), Url :: binary(), Opts :: map()) ->
                         {ok, SourceRef :: term(), State :: term()} | not_supported | {error, term()}.

source_stream/4

-callback source_stream(State :: term(), SourceRef :: term(), Path :: binary(), Opts :: map()) ->
                           {stream, StreamRef :: term(), State :: term()} |
                           {data, Data :: binary(), State :: term()} |
                           {error, term()}.

source_terminate/2

-callback source_terminate(State :: term(), Reason :: term()) -> ok.

Functions

cancel(StreamRef)

handle_call(Request, From, State)

handle_cast(Request, State)

handle_info(Info, State)

init(_)

load(Url, Path)

start_link(Opts)

stream(Url, Path, SinkMod, SinkParams)

terminate(Reason, State)