View Source grisp_updater_source behaviour (grisp_updater v2.0.0)

Summary

Callbacks

-callback source_cancel(State :: term(), SourceRef :: term(), StreamRef :: term()) -> State :: term().
-callback source_close(State :: term(), SourceRef :: term()) -> State :: term().
Link to this callback

source_handle/2

View Source (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()}.
-callback source_init(Opts :: map()) -> {ok, State :: term()} | {error, term()}.
-callback source_open(State :: term(), Url :: binary(), Opts :: map()) ->
                         {ok, SourceRef :: term(), State :: term()} | not_supported | {error, term()}.
-callback source_stream(State :: term(), SourceRef :: term(), Path :: binary(), Opts :: map()) ->
                           {stream, StreamRef :: term(), State :: term()} |
                           {data, Data :: binary(), State :: term()} |
                           {error, term()}.
-callback source_terminate(State :: term(), Reason :: term()) -> ok.

Functions