Markov.Database.Operation (markov v3.0.0)

Link to this section Summary

Functions

Require the needed modules to use the table effectively.

Add a copy of the table on the given node with the given mode.

Add the index in the table for the given attribute.

Read a record based on a slot, see mnesia:dirty_slot.

The in order keyword list of attributes passed when the table was defined.

Check if the table is a bag.

Clear the content of the table.

Change the copying mode of the table on the given node, see mnesia:change_table_copy_type.

Get the number of records in the table.

Create the table with the given copying mode and inherent definition.

Return the database the table belongs to.

Delete the record or the given key from the table, see mnesia:dirty_delete and mnesia:dirty_delete_object.

Delete the record or the given key from the table, see mnesia:delete and mnesia:delete_object.

Delete the record or the given key from the table with the given lock, see mnesia:delete and mnesia:delete_object.

Delete a copy of the table from the given node.

Delete the index in the table for the given attribute.

Destroy the table, raising if an error occurs.

Destroy the table.

Return the first key or record in the table, see mnesia:dirty_first.

Return the first key or record in the table, see mnesia:first.

Fold the whole table from the left, see mnesia:foldl.

Fold the whole table from the right, see mnesia:foldr.

Force load the table.

Get the name of the id key.

Get information about the table, see mnesia:table_info.

Return the key of the record.

Return all keys in the table, see mnesia:dirty_all_keys.

Return all the keys in the table, see mnesia:all_keys.

Return the last key or record in the table, see mnesia:dirty_last.

Return the last key or record in the table, see mnesia:last.

Lock the table with the given lock.

Change the table majority.

Set master nodes for the table, see mnesia:set_master_nodes.

Select records in the table using simple don't care values, see mnesia:dirty_match_object.

Select records in the table using simple don't care values, see mnesia:match_object.

Check if the key is present in the table.

Change the access of the table, see mnesia:change_table_access_mode.

Move a copy of the table from the given node to another given node.

Return the next key or record in the table, see mnesia:dirty_next.

Return the next key or record in the table, see mnesia:next.

The options passed when the table was defined.

Check if the table is an ordered set.

Return the previous key or record in the table, see mnesia:dirty_prev.

Return the previous key or record in the table, see mnesia:prev.

Change the table loading priority.

Return properties of the table.

Read records from the table, see mnesia:dirty_read.

Read records from the table with the given key and given lock, see mnesia:read.

Read records from the table based on a secondary index given as position, see mnesia:dirty_index_read.

Read records from the table based on a secondary index given as position, see mnesia:index_read.

Select records in the table using a match_spec, see mnesia:dirty_select.

Select records in the table using a match_spec, see mnesia:select.

Select records in the given table using a match_spec passing a limit or a lock kind, see mnesia:select.

Select records in the given table using a match_spec passing a limit and a lock kind, see mnesia:select.

Check if the table is a set.

Return an iterator to use with the Enum functions using dirty operations to retrieve information.

Return an iterator to use with Enum functions.

Return the type of the table.

Wait for the table optionally with a timeout.

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:dirty_select.

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:select.

Write the record to the table, see mnesia:dirty_write.

Write the record to the table, see mnesia:write.

Link to this section Types

Link to this type

autoincrement()

@type autoincrement() :: non_neg_integer()
@type t() :: %Markov.Database.Operation{
  argument: term(),
  model: term(),
  ts: non_neg_integer(),
  type: Markov.log_entry_type()
}

Link to this section Functions

Link to this macro

__using__(opts)

(macro)

Require the needed modules to use the table effectively.

Link to this function

add_copy(node, type \\ :disk)

@spec add_copy(node(), Amnesia.Table.cv()) :: Amnesia.Table.o()

Add a copy of the table on the given node with the given mode.

Link to this function

add_index(attribute)

@spec add_index(atom()) :: Amnesia.Table.o()

Add the index in the table for the given attribute.

@spec at!(integer()) :: t() | nil | no_return()

Read a record based on a slot, see mnesia:dirty_slot.

@spec attributes() :: Keyword.t()

The in order keyword list of attributes passed when the table was defined.

@spec bag?() :: boolean()

Check if the table is a bag.

@spec clear() :: Amnesia.Table.o()

Clear the content of the table.

Link to this function

copying(node, to)

@spec copying(node(), Amnesia.Table.cv()) :: Amnesia.Table.o()

Change the copying mode of the table on the given node, see mnesia:change_table_copy_type.

modes

Modes

  • :disk sets :disc_copies mode
  • :disk! sets :disc_only_copies mode
  • :memory sets :ram_copies mode
@spec count() :: non_neg_integer()

Get the number of records in the table.

Link to this function

create!(copying \\ [])

@spec create!(Amnesia.Table.c()) :: :ok | no_return()
Link to this function

create(copying \\ [])

@spec create(Amnesia.Table.c()) :: Amnesia.o()

Create the table with the given copying mode and inherent definition.

@spec database() :: module()

Return the database the table belongs to.

@spec delete!(t() | any()) :: :ok | no_return()

Delete the record or the given key from the table, see mnesia:dirty_delete and mnesia:dirty_delete_object.

@spec delete(any() | t()) :: :ok | no_return()

Delete the record or the given key from the table, see mnesia:delete and mnesia:delete_object.

Link to this function

delete(self, lock)

@spec delete(atom() | any(), t() | atom()) :: :ok | no_return()

Delete the record or the given key from the table with the given lock, see mnesia:delete and mnesia:delete_object.

locks

Locks

  • :write sets a :write lock
  • :write! sets a :sticky_write lock
Link to this function

delete_copy(node)

@spec delete_copy(node()) :: Amnesia.Table.o()

Delete a copy of the table from the given node.

Link to this function

delete_index(attribute)

@spec delete_index(atom()) :: Amnesia.Table.o()

Delete the index in the table for the given attribute.

@spec destroy!() :: :ok | no_return()

Destroy the table, raising if an error occurs.

@spec destroy() :: Amnesia.Table.o()

Destroy the table.

Link to this function

first!(key \\ false)

@spec first!(boolean()) :: any() | t() | nil | no_return()

Return the first key or record in the table, see mnesia:dirty_first.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function

first(key \\ false, lock \\ :read)

@spec first(boolean(), atom()) :: any() | t() | nil | no_return()

Return the first key or record in the table, see mnesia:first.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function

foldl(acc, fun)

@spec foldl(any(), (t(), any() -> any())) :: any() | no_return()

Fold the whole table from the left, see mnesia:foldl.

Link to this function

foldr(acc, fun)

@spec foldr(any(), (t(), any() -> any())) :: any() | no_return()

Fold the whole table from the right, see mnesia:foldr.

@spec force() :: :yes | {:error, any()}

Force load the table.

Link to this function

hook_read!(_, _)

Link to this function

hook_read(_, _)

@spec id() :: atom()

Get the name of the id key.

@spec info(atom()) :: any()

Get information about the table, see mnesia:table_info.

@spec key(t()) :: any()

Return the key of the record.

@spec keys!() :: list() | no_return()

Return all keys in the table, see mnesia:dirty_all_keys.

@spec keys() :: list() | no_return()

Return all the keys in the table, see mnesia:all_keys.

Link to this function

last!(key \\ false)

@spec last!(boolean()) :: any() | t() | nil | no_return()

Return the last key or record in the table, see mnesia:dirty_last.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function

last(key \\ false, lock \\ :read)

@spec last(boolean(), atom()) :: any() | t() | nil | no_return()

Return the last key or record in the table, see mnesia:last.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

@spec lock(:write | :write! | :read) :: [node()] | :ok | no_return()

Lock the table with the given lock.

locks

Locks

  • :write sets a :write lock
  • :write! sets a :sticky_write lock
  • :read sets a :read lock
Link to this function

majority(value)

@spec majority(boolean()) :: Amnesia.Table.o()

Change the table majority.

Link to this function

master_nodes(nodes)

@spec master_nodes([node()]) :: :ok | {:error, any()}

Set master nodes for the table, see mnesia:set_master_nodes.

Link to this function

match!(pattern)

@spec match!(any()) :: [t()] | nil | no_return()

Select records in the table using simple don't care values, see mnesia:dirty_match_object.

Link to this function

match(lock \\ :read, pattern)

@spec match(:read | :write, any()) :: [t()] | nil | no_return()

Select records in the table using simple don't care values, see mnesia:match_object.

@spec member?(any()) :: boolean()

Check if the key is present in the table.

@spec mode(:both | :read!) :: Amnesia.Table.o()

Change the access of the table, see mnesia:change_table_access_mode.

modes

Modes

  • :both sets read and write mode, it's the default.
  • :read! sets read-only mode.
Link to this function

move_copy(from, to)

@spec move_copy(node(), node()) :: Amnesia.Table.o()

Move a copy of the table from the given node to another given node.

@spec next!(any() | t()) :: any() | t() | nil | no_return()

Return the next key or record in the table, see mnesia:dirty_next.

If you're calling this function from an instance of the table (a record in it), it will get you the next record, if you're calling it directly on the module it will treat the argument as key to start from and return you the next key.

@spec next(any() | t()) :: any() | t() | nil | no_return()

Return the next key or record in the table, see mnesia:next.

If you're calling this function from an instance of the table (a record in it), it will get you the next record, if you're calling it directly on the module it will treat the argument as key to start from and return you the next key.

@spec options() :: Keyword.t()

The options passed when the table was defined.

@spec ordered_set?() :: boolean()

Check if the table is an ordered set.

@spec prev!(any() | t()) :: any() | t() | nil | no_return()

Return the previous key or record in the table, see mnesia:dirty_prev.

If you're calling this function from an instance of the table (a record in it), it will get you the previous record, if you're calling it directly on the module it will treat the argument as key to start from and return you the previous key.

@spec prev(any() | t()) :: any() | t() | nil | no_return()

Return the previous key or record in the table, see mnesia:prev.

If you're calling this function from an instance of the table (a record in it), it will get you the previous record, if you're calling it directly on the module it will treat the argument as key to start from and return you the previous key.

Link to this function

priority(value)

@spec priority(integer()) :: Amnesia.Table.o()

Change the table loading priority.

@spec properties() :: Keyword.t()

Return properties of the table.

@spec read!(any()) :: [t()] | nil | no_return()

Read records from the table, see mnesia:dirty_read.

Link to this function

read(key, lock \\ :read)

@spec read(any(), :read | :write | :write!) :: [t()] | nil | no_return()

Read records from the table with the given key and given lock, see mnesia:read.

locks

Locks

  • :write sets a :write lock
  • :write! sets a :sticky_write lock
  • :read sets a :read lock
Link to this function

read_at!(key, position)

@spec read_at!(any(), integer() | atom()) :: [t()] | nil | no_return()

Read records from the table based on a secondary index given as position, see mnesia:dirty_index_read.

Link to this function

read_at(key, position)

@spec read_at(any(), integer() | atom()) :: [t()] | nil | no_return()

Read records from the table based on a secondary index given as position, see mnesia:index_read.

@spec select!(any()) :: Selection.t() | nil | no_return()

Select records in the table using a match_spec, see mnesia:dirty_select.

@spec select(any()) :: Amnesia.Table.Selection.t() | nil | no_return()

Select records in the table using a match_spec, see mnesia:select.

Link to this function

select(lock_or_limit, spec)

@spec select(integer() | :read | :write, any()) ::
  Amnesia.Table.Selection.t() | nil | no_return()

Select records in the given table using a match_spec passing a limit or a lock kind, see mnesia:select.

Link to this function

select(lock_or_limit, limit_or_lock, spec)

@spec select(integer() | :read | :write, integer() | :read | :write, integer()) ::
  Amnesia.Table.Selection.t() | nil | no_return()

Select records in the given table using a match_spec passing a limit and a lock kind, see mnesia:select.

@spec set?() :: boolean()

Check if the table is a set.

@spec stream!() :: Amnesia.Table.Stream.t()

Return an iterator to use with the Enum functions using dirty operations to retrieve information.

Link to this function

stream(lock \\ :read)

@spec stream(:read | :write | :write!) :: Amnesia.Table.Stream.t()

Return an iterator to use with Enum functions.

@spec type(t()) :: :set | :ordered_set | :bag

Return the type of the table.

Link to this function

wait(timeout \\ :infinity)

@spec wait(integer() | :infinity) :: :ok | {:timeout, [atom()]} | {:error, atom()}

Wait for the table optionally with a timeout.

Link to this macro

where!(spec, options \\ [])

(macro)

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:dirty_select.

options

Options

  • select - Exquisite selector spec
  • qualified - whether to set a name for the record or not
Link to this macro

where(spec, options \\ [])

(macro)

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:select.

options

Options

  • limit - sets the count of elements to select in every continuation
  • lock - sets the kind of lock to use
  • select - Exquisite selector spec
  • qualified - whether to set a name for the record or not
@spec write!(t()) :: t() | no_return()

Write the record to the table, see mnesia:dirty_write.

Missing fields tagged as autoincrement will be incremented with the counter if nil.

Link to this function

write(self, lock \\ :write)

Write the record to the table, see mnesia:write.

Missing fields tagged as autoincrement will be incremented with the counter if nil.