amnesia v0.2.8 Amnesia

Link to this section Summary

Functions

Abort the current transaction.

Run the passed function or block in a dirty asynchronous context, see mnesia:async_dirty.

Run the passed function in a dirty asynchronous context passing over the passed arguments, see mnesia:async_dirty.

Cancel the current transaction.

Change the debug level.

Define a database with the given name and the various definitions in the block.

Dump the database to a text file, see mnesia:dump_to_textfile.

Get an error description from an error code, see mnesia:error_description.

Run the passed function or block in the ETS context, see mnesia:ets.

Run the passed function in the ETS context passing over the passed arguments, see mnesia:ets.

Print information about the mnesia database, see mnesia:info.

Return information about the running instance, see mnesia:system_info.

Load a dump from a text file, see mnesia:load_textfile.

Lock the whole database on the given node for the given keys with the given lock, see mnesia:lock.

Set master nodes, see mnesia:set_master_nodes.

Start the database, see mnesia:start.

Stop the database, see mnesia:stop.

Run the passed function or block in a dirty synchronous context, see mnesia:sync_dirty.

Run the passed function in a dirty synchronous context passing over the passed arguments, see mnesia:sync_dirty.

Start a transaction with the given block or function, see mnesia:transaction.

Start a transaction with the given function passing the passed arguments to it, see mnesia:transaction.

Start a transaction with the given function passing the passed arguments to it, trying to take a lock maximum retries times, see mnesia:transaction.

Start a synchronous transaction with the given block or function, see mnesia:sync_transaction.

Start a synchronous transaction with the given function passing the passed arguments to it, see mnesia:sync_transaction.

Start a synchronous transaction with the given function passing the passed arguments to it, trying to take a lock maximum retries times, see mnesia:sync_transaction.

Check if it's inside a transaction or not, see mnesia:is_transaction.

Link to this section Types

Link to this type

debug_level()

debug_level() :: :none | :verbose | :debug | :trace | false | true

Link to this section Functions

Link to this function

abort(reason)

abort(any()) :: no_return()

Abort the current transaction.

Link to this macro

async(term)

(macro)
async([{:do, term()}] | term()) :: any()

Run the passed function or block in a dirty asynchronous context, see mnesia:async_dirty.

Link to this function

async(fun, args)

async(function(), list()) :: any()

Run the passed function in a dirty asynchronous context passing over the passed arguments, see mnesia:async_dirty.

Link to this function

cancel(value \\ nil)

cancel(any()) :: no_return()

Cancel the current transaction.

Change the debug level.

Link to this macro

defdatabase(name, list)

(macro)

Define a database with the given name and the various definitions in the block.

Example

use Amnesia

defdatabase Foo do
  deftable Bar, [:id, :a], type: :bag

  deftable Baz, [:id, :a, :b] do
    def foo(self)
      42
    end
  end
end
Link to this function

dump(path)

dump(String.t()) :: none()

Dump the database to a text file, see mnesia:dump_to_textfile.

Link to this function

error(code)

error(atom()) :: String.t()

Get an error description from an error code, see mnesia:error_description.

Link to this macro

ets(term)

(macro)
ets([{:do, term()}] | term()) :: any()

Run the passed function or block in the ETS context, see mnesia:ets.

Link to this function

ets(fun, args)

ets(function(), list()) :: any()

Run the passed function in the ETS context passing over the passed arguments, see mnesia:ets.

Link to this function

info()

info() :: :ok

Print information about the mnesia database, see mnesia:info.

Link to this function

info(key)

info(atom()) :: any()

Return information about the running instance, see mnesia:system_info.

Link to this function

load(path)

load(String.t()) :: none()

Load a dump from a text file, see mnesia:load_textfile.

Link to this function

lock(key, nodes, mode)

lock(atom(), [node()], :write | :write! | :read) :: [node()] | :ok | no_return()

Lock the whole database on the given node for the given keys with the given lock, see mnesia:lock.

Locks

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

master_nodes(nodes)

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

Set master nodes, see mnesia:set_master_nodes.

Link to this function

start()

start() :: :ok | {:error, any()}

Start the database, see mnesia:start.

Link to this function

stop()

stop() :: :stopped

Stop the database, see mnesia:stop.

Link to this macro

sync(term)

(macro)
sync([{:do, term()}] | term()) :: any()

Run the passed function or block in a dirty synchronous context, see mnesia:sync_dirty.

Link to this function

sync(fun, args)

sync(function(), list()) :: any()

Run the passed function in a dirty synchronous context passing over the passed arguments, see mnesia:sync_dirty.

Link to this macro

transaction(term)

(macro)
transaction([{:do, term()}] | term()) :: any() | no_return()

Start a transaction with the given block or function, see mnesia:transaction.

Link to this function

transaction(fun, args)

transaction(function(), list()) :: any() | no_return()

Start a transaction with the given function passing the passed arguments to it, see mnesia:transaction.

Link to this function

transaction(fun, args, retries)

transaction(function(), list(), integer()) :: any() | no_return()

Start a transaction with the given function passing the passed arguments to it, trying to take a lock maximum retries times, see mnesia:transaction.

Link to this macro

transaction!(term)

(macro)
transaction!([{:do, term()}] | term()) :: any() | no_return()

Start a synchronous transaction with the given block or function, see mnesia:sync_transaction.

Link to this function

transaction!(fun, args)

transaction!(function(), list()) :: any() | no_return()

Start a synchronous transaction with the given function passing the passed arguments to it, see mnesia:sync_transaction.

Link to this function

transaction!(fun, args, retries)

transaction!(function(), list(), integer()) :: any() | no_return()

Start a synchronous transaction with the given function passing the passed arguments to it, trying to take a lock maximum retries times, see mnesia:sync_transaction.

Link to this function

transaction?()

transaction?() :: boolean()

Check if it's inside a transaction or not, see mnesia:is_transaction.