Copyright © (C) 2016, Project-FiFo UG
Authors: Heinz Nikolaus Gies (heinz@project-fifo.net).
abstract datatype: estore()
new_opt() = no_index | {file_size, tagged_time()} | {grace, tagged_time()}
tagged_time() = pos_integer() | {pos_integer(), time_unit()}
time_unit() = ns | us | ms | s | m | h | d | w
append/2 | Inserts one or more events into a event store. |
close/1 | Closes all the files in an event store. |
count/1 | Returns an APPROXIMATE count of elements in the estore. |
delete/1 | Deletes the store and all files within it. |
delete/2 | Delete all efiles that start before a certain point in time. |
eid/0 | Utility function that generates a event id. |
eid/1 | Creates a event id, using a sha1 hash on the node, the pid, erlang:unique_integer and a passed term. |
event/1 | Creates a event tuple with timestamp, an eid and the evnt passed. |
fold/3 | Folds the entire store, passing each event into the fold function. |
fold/5 | Folds over a time range, passing each event into the fold function. |
make_splits/3 | Splits a start end end based into chunks based on the file sized. |
new/2 | Creates a new estore, the efiles will be stored in the given directory. |
open/1 | |
open/2 | |
read/3 | Reads a time range from the estore, it will traverse multiple efiles if required. |
append(Es::[efile:event()], EStore::estore()) -> {ok, estore()}
Inserts one or more events into a event store. The events are expected to be ordered! Sharding will be done automatically and does not need to be handled outside of the estore.
As in fold strict order is not guarantted.close(EStore::estore()) -> ok
Closes all the files in an event store.
Returns an APPROXIMATE count of elements in the estore. This uses the index as an indicator and by that should return a ballpark of how many entries exist.
delete(EStore::estore()) -> ok
Deletes the store and all files within it.
Delete all efiles that start before a certain point in time. this means some events that existed before 'Before' can still be in there.
eid() -> <<_:32>>
Utility function that generates a event id. This is the same
as eid/1
with the argument estore.
eid(E::term()) -> <<_:32>>
Creates a event id, using a sha1 hash on the node, the pid, erlang:unique_integer and a passed term.
event(E) -> any()
Creates a event tuple with timestamp, an eid and the evnt
passed. The timestamp does NOT have to be provided this function
calls erlang:system_time/1
to get it.
fold(Fun::efile:fold_fun(), Acc::any(), EStore::estore()) -> {ok, any(), estore()}
Folds the entire store, passing each event into the fold function. Strict order is not guarantted. Events might come out of order but will remain in the grace period.
fold(Start::pos_integer(), End::pos_integer(), Fun::efile:fold_fun(), Acc::any(), EStore::estore()) -> {ok, any(), estore()}
Folds over a time range, passing each event into the fold function. Strict order is not guarantted. Events might come out of order but will remain in the grace period.
make_splits(Time, End, Size) -> any()
Splits a start end end based into chunks based on the file sized. This is a utility function that can be used for distributing estore files.
Creates a new estore, the efiles will be stored in the given directory.
open(Dir::string() | binary()) -> {ok, estore()} | {error, file_size | bad_index | enoent}
open(Dir::string() | binary(), Opts::[new_opt()]) -> {ok, estore()} | {error, file_size | bad_index | enoent}
read(Start::pos_integer(), End::pos_integer(), Estore::estore()) -> {ok, [efile:event()], estore()}
Reads a time range from the estore, it will traverse multiple efiles if required. Keep in mind that this will create one big aggregator for all events using fold/5 might be a better choice for larger datasets.
As in fold strict order is not guarantted.Generated by EDoc, Sep 19 2016, 14:35:03.