phasedb v0.0.2 PhaseDB.Series

Provies an interface for creating, dropping and querying Series'.

Currently only supports ETS-based cursors, but DETS will be added later on.

Summary

Functions

Creates a series for a given Database and series_name

Retrieve cursor to a given series' storage. Mostly used by PhaseDB.Queryable implementations

Drops a Series if it exists

Test whether a series actually exists

Force the series to run a GC flush

Get an existing series

Insert a sample into the series. Used by Insertable

Subscribe to events from this series. The calling process will receive events about this series

Unsubscribe the calling process to updates about this series

Functions

create(db, series_name)

Specs

create({:error, any}, any) :: {:error, any}
create(db :: %PhaseDB.Database{name: term}, series_name :: binary) :: %PhaseDB.Series{database: term, name: term, options: term}

Creates a series for a given Database and series_name.

Returns %Series{} or {:error, reason}

create(db, series_name, opts)

Specs

create({:error, any}, any, any) :: {:error, any}
create(db :: %PhaseDB.Database{name: term}, series_name :: binary, opts :: [...]) :: %PhaseDB.Series{database: term, name: term, options: term}
cursor(e)

Specs

cursor({:error, any}) :: {:error, any}
cursor(series :: %PhaseDB.Series{database: term, name: term, options: term}) ::
  struct |
  {:error, binary}

Retrieve cursor to a given series' storage. Mostly used by PhaseDB.Queryable implementations.

drop(series)

Specs

drop({:error, any}) :: {:error, any}
drop(series :: %PhaseDB.Series{database: term, name: term, options: term}) ::
  :ok |
  {:error, binary}

Drops a Series if it exists.

Returns :ok or {:error, reason}

exists?(series)

Specs

exists?(series :: %PhaseDB.Series{database: term, name: term, options: term}) ::
  true |
  false

Test whether a series actually exists.

Returns true or false

gc(series)

Specs

gc(series :: %PhaseDB.Series{database: term, name: term, options: term}) ::
  {:ok, integer} |
  {:error, binary}

Force the series to run a GC flush.

get(e, s_name)

Specs

get({:error, any}, any) :: {:error, any}
get(db :: %PhaseDB.Database{name: term}, series_name :: binary) :: %PhaseDB.Series{database: term, name: term, options: term}

Get an existing series.

Returns %Series{} or `{:error, reason}

insert(series, sample)

Specs

insert(series :: %PhaseDB.Series{database: term, name: term, options: term}, sample :: %PhaseDB.Sample{actual: term, received_at: term, recorded_at: term, tags: term, value: term}) ::
  {:ok, integer} |
  {:error, binary}

Insert a sample into the series. Used by Insertable.

subscribe(series)

Specs

subscribe(series :: %PhaseDB.Series{database: term, name: term, options: term}) ::
  :ok |
  {:error, binary}

Subscribe to events from this series. The calling process will receive events about this series..

unsubscribe(series)

Specs

unsubscribe(series :: %PhaseDB.Series{database: term, name: term, options: term}) :: :ok

Unsubscribe the calling process to updates about this series.