Sidx (sidx v0.1.4)
Subindex public API
Link to this section Summary
Types
Table options
Functions
Attempts to perform maintenance tasks on and close table
Inserts one row into the table. Setting safe
to false
speeds up the
execution, but is only actually safe if the time since the last operation is
less than the configured partition unload timeout and the correct number of
keys is provided
Performs maintenance tasks (such as repartitioning) on a table. This is done
automatically by close!/1
. Performing operations on the table while it's
being maintained leads to to undefined behavior.
Attempts to open table at path
or create one with opts
if it doesn't exist
Selects rows from the table. Setting safe
to false
speeds up the
execution, but is only actually safe if the time since the last operation is
less than the configured partition unload timeout and at least one key is
provided
Selects rows from the table, applies fun
to each row and writes the results back.
Setting safe
to false
speeds up the execution, but is only actually safe if
the time since the last operation is less than the configured partition unload
timeout and at least one key is provided
Link to this section Types
table_option()
@type table_option() :: {:keys, pos_integer()} | {:part_size, pos_integer()} | {:part_timeout, pos_integer()} | {:part_initial, pos_integer()} | {:compress, boolean()} | {:slot_size, pos_integer()}
Table options:
keys
: the number of keys that together map to one value, forming one rowpart_size
: max number of rows in one partition ()part_timeout
: the time (in ms) partitions are held in memory forpart_initial
: the number of initial partitionscompress
: compress partitions using gzip (boolean)slot_size
: slot size (bytes) in the unified partition file
Link to this section Functions
close!(table)
@spec close!(table :: Sidx.Table.t()) :: :ok
Attempts to perform maintenance tasks on and close table
insert(table, keys, value, safe \\ true)
@spec insert( table :: Sidx.Table.t(), keys :: [term()], value :: term(), safe :: boolean() ) :: :ok | {:error, term()}
Inserts one row into the table. Setting safe
to false
speeds up the
execution, but is only actually safe if the time since the last operation is
less than the configured partition unload timeout and the correct number of
keys is provided
maintain(table)
@spec maintain(table :: Sidx.Table.t()) :: {[term()], Sidx.Table.t()}
Performs maintenance tasks (such as repartitioning) on a table. This is done
automatically by close!/1
. Performing operations on the table while it's
being maintained leads to to undefined behavior.
open!(path, opts \\ [])
@spec open!(path :: String.t(), opts :: [table_option()]) :: Sidx.Table.t() | no_return()
Attempts to open table at path
or create one with opts
if it doesn't exist
select(table, keys, safe \\ true)
@spec select(table :: Sidx.Table.t(), keys :: [term()], safe :: boolean()) :: {:ok, [term()]} | {:error, term()}
Selects rows from the table. Setting safe
to false
speeds up the
execution, but is only actually safe if the time since the last operation is
less than the configured partition unload timeout and at least one key is
provided
update(table, keys, fun, safe \\ true)
@spec update( table :: Sidx.Table.t(), keys :: [term()], fun :: ([term()], term() -> term()), safe :: boolean() ) :: :ok | {:error, term()}
Selects rows from the table, applies fun
to each row and writes the results back.
Setting safe
to false
speeds up the execution, but is only actually safe if
the time since the last operation is less than the configured partition unload
timeout and at least one key is provided