GSMLG.Mnesia (GSMLG.Mnesia v0.1.1)

Simple + Powerful interface to the Erlang Mnesia Database.

See the README to get started.

Link to this section Summary

Functions

Tells GSMLG.Mnesia about other nodes running GSMLG.Mnesia/Mnesia.

Prints :mnesia information to console.

Start the GSMLG.Mnesia Application.

Stop the GSMLG.Mnesia Application.

Returns all information about the Mnesia system.

Link to this section Functions

Link to this function

add_nodes(nodes)

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

Tells GSMLG.Mnesia about other nodes running GSMLG.Mnesia/Mnesia.

You can use this to connect to and synchronize with other nodes at runtime and/or on discovery, to take full advantage of the distribution mode of GSMLG.Mnesia and Mnesia.

This is a wrapper method around :mnesia.change_config/2.

example

Example

# Connect to GSMLG.Mnesia running on a specific node
GSMLG.Mnesia.add_nodes(:node_xyz@some_host)

# Add all connected nodes to GSMLG.Mnesia distributed database
GSMLG.Mnesia.add_nodes(Node.list())
@spec info() :: :ok

Prints :mnesia information to console.

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

Start the GSMLG.Mnesia Application.

This starts GSMLG.Mnesia and :mnesia along with some sane application defaults. See :mnesia.start/0 for more details.

@spec stop() :: :ok | {:error, any()}

Stop the GSMLG.Mnesia Application.

Link to this function

system(key \\ :all)

@spec system(atom()) :: any()

Returns all information about the Mnesia system.

Optionally accepts a key atom argument which returns result for only that key. Will throw an exception if that key is invalid. See :mnesia.system_info/0 for more information and a full list of allowed keys.

Avaliable keys: [ :access_module, :auto_repair, :backend_types, :backup_module, :checkpoints, :db_nodes, :debug, :directory, :dump_log_load_regulation, :dump_log_time_threshold, :dump_log_update_in_place, :dump_log_write_threshold, :event_module, :extra_db_nodes, :fallback_activated, :held_locks, :ignore_fallback_at_startup, :fallback_error_function, :is_running, :local_tables, :lock_queue, :log_version, :master_node_tables, :max_wait_for_decision, :protocol_version, :running_db_nodes, :schema_location, :schema_version, :subscribers, :tables, :transaction_commits, :transaction_failures, :transaction_log_writes, :transaction_restarts, :transactions, :use_dir, :core_dir, :no_table_loaders, :dc_dump_limit, :send_compressed, :max_transfer_size, :version]

Link to this function

transaction(fun)

See GSMLG.Mnesia.Transaction.execute/1.

Link to this function

transaction!(fun)

See GSMLG.Mnesia.Transaction.execute!/1.

See GSMLG.Mnesia.Table.wait/1.

Link to this function

wait(tables, timeout)

See GSMLG.Mnesia.Table.wait/2.