grisp_updater_source behaviour (grisp_updater v2.3.0)
View SourceSummary
Callbacks
Cancel an active stream.
Close an opened session.
Handle backend messages. Return pass | {ok,State} | {data|done|stream_error|source_error,...}.
Initialize a source backend with Opts. Return opaque State.
Open a session for Url if supported; return SourceRef used for subsequent streaming.
Start streaming or return full data. For streams, later emit data/done via source_handle/2.
Termination hook for cleanup.
Callbacks
-callback source_cancel(State :: term(), SourceRef :: term(), StreamRef :: term()) -> State :: term().
Cancel an active stream.
Close an opened session.
-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()}.
Handle backend messages. Return pass | {ok,State} | {data|done|stream_error|source_error,...}.
Initialize a source backend with Opts. Return opaque State.
-callback source_open(State :: term(), Url :: binary(), Opts :: map()) -> {ok, SourceRef :: term(), State :: term()} | not_supported | {error, term()}.
Open a session for Url if supported; return SourceRef used for subsequent streaming.
-callback source_stream(State :: term(), SourceRef :: term(), Path :: binary(), Opts :: map()) -> {stream, StreamRef :: term(), State :: term()} | {data, Data :: binary(), State :: term()} | {error, term()}.
Start streaming or return full data. For streams, later emit data/done via source_handle/2.
Termination hook for cleanup.