Erlang logo
User's Guide
Reference Manual
Release Notes
PDF
Top

Mnesia
Reference Manual
Version 4.4.15


Expand All
Contract All

Table of Contents

mnesia_registry

MODULE

mnesia_registry

MODULE SUMMARY

Dump support for registries in erl_interface.

DESCRIPTION

The module mnesia_registry is usually part of erl_interface, but for the time being, it is a part of the Mnesia application.

mnesia_registry is mainly an module intended for internal usage within OTP, but it has two functions that are exported for public use.

On C-nodes erl_interface has support for registry tables. These reside in RAM on the C-node but they may also be dumped into Mnesia tables. By default, the dumping of registry tables via erl_interface causes a corresponding Mnesia table to be created with mnesia_registry:create_table/1 if necessary.

The tables that are created with these functions can be administered as all other Mnesia tables. They may be included in backups or replicas may be added etc. The tables are in fact normal Mnesia tables owned by the user of the corresponding erl_interface registries.

EXPORTS

create_table(Tab) -> ok | exit(Reason)

This is a wrapper function for mnesia:create_table/2 which creates a table (if there is no existing table) with an appropriate set of attributes. The table will only reside on the local node and its storage type will be the same as the schema table on the local node, ie. {ram_copies,[node()]} or {disc_copies,[node()]}.

It is this function that is used by erl_interface to create the Mnesia table if it did not already exist.

create_table(Tab, TabDef) -> ok | exit(Reason)

This is a wrapper function for mnesia:create_table/2 which creates a table (if there is no existing table) with an appropriate set of attributes. The attributes and TabDef are forwarded to mnesia:create_table/2. For example, if the table should reside as disc_only_copies on all nodes a call would look like:

          TabDef = [{{disc_only_copies, node()|nodes()]}],
          mnesia_registry:create_table(my_reg, TabDef)
        

See Also

mnesia(3), erl_interface(3)