View Source grisp_updater_storage behaviour (grisp_updater v2.0.0)

Summary

Callbacks

-callback storage_close(State :: term(), Descriptor :: term()) -> {ok, State :: term()}.
-callback storage_init(Opts :: map()) -> {ok, State :: term()} | {error, term()}.
-callback storage_open(State :: term(), Device :: binary()) ->
                          {ok, Descriptor :: term(), State :: term()} | {error, term()}.
-callback storage_prepare(State :: term(), Target :: target(), ObjSize :: non_neg_integer()) ->
                             ok | {error, term()}.
-callback storage_read(State :: term(),
                       Descriptor :: term(),
                       Offset :: non_neg_integer(),
                       Size :: non_neg_integer()) ->
                          {ok, Data :: binary(), State :: term()} | {error, term()}.
-callback storage_terminate(State :: term(), Reason :: term()) -> ok.
-callback storage_write(State :: term(),
                        Descriptor :: term(),
                        Offset :: non_neg_integer(),
                        Data :: iolist()) ->
                           {ok, State :: term()} | {error, term()}.

Functions