reckon_db_archive_file (reckon_db v1.2.6)
View SourceFile-based archive backend for reckon-db
Stores archived events as Erlang term files on the local filesystem. Archives are organized in directories by store and stream.
Directory structure:
{base_dir}/
{store_id}/
{stream_id}/
0-99.archive
100-199.archive
Summary
Functions
Archive events to a file.
Delete an archive file.
Check if an archive exists.
Initialize the file archive backend.
List all archive keys for a stream.
Read events from an archive file.
Types
-type event() :: #event{event_id :: binary(), event_type :: binary(), stream_id :: binary(), version :: non_neg_integer(), data :: map() | binary(), metadata :: map(), tags :: [binary()] | undefined, timestamp :: integer(), epoch_us :: integer(), data_content_type :: binary(), metadata_content_type :: binary()}.
Functions
-spec archive(#state{base_dir :: string()}, binary(), [event()]) -> {ok, #state{base_dir :: string()}} | {error, term()}.
Archive events to a file.
-spec delete(#state{base_dir :: string()}, binary()) -> {ok, #state{base_dir :: string()}} | {error, term()}.
Delete an archive file.
Check if an archive exists.
Initialize the file archive backend.
Options: - base_dir: Directory where archives are stored (required)
-spec list(#state{base_dir :: string()}, atom(), binary()) -> {ok, [binary()], #state{base_dir :: string()}} | {error, term()}.
List all archive keys for a stream.
-spec read(#state{base_dir :: string()}, binary()) -> {ok, [event()], #state{base_dir :: string()}} | {error, term()}.
Read events from an archive file.