Erlang -- mnesia_registry

User's Guide
Reference Manual
Release Notes
PDF
Top

Mnesia
Reference Manual
Version 4.7.1

Expand All
Contract All

Table of Contents

- mnesia
  - Top of manual page
  - abort/1
  - activate_checkpoint/1
  - activity/2
  - activity/4
  - add_table_copy/3
  - add_table_index/2
  - all_keys/1
  - async_dirty/2
  - backup/1
  - backup_checkpoint/2
  - change_config/2
  - change_table_access_mode/2
  - change_table_copy_type/3
  - change_table_load_order/2
  - change_table_majority/2
  - clear_table/1
  - create_schema/1
  - create_table/2
  - deactivate_checkpoint/1
  - del_table_copy/2
  - del_table_index/2
  - delete/1
  - delete/3
  - delete_object/1
  - delete_object/3
  - delete_schema/1
  - delete_table/1
  - dirty_all_keys/1
  - dirty_delete/1
  - dirty_delete/2
  - dirty_delete_object/1
  - dirty_delete_object/2
  - dirty_first/1
  - dirty_index_match_object/2
  - dirty_index_match_object/3
  - dirty_index_read/3
  - dirty_last/1
  - dirty_match_object/1
  - dirty_match_object/2
  - dirty_next/2
  - dirty_prev/2
  - dirty_read/1
  - dirty_read/2
  - dirty_select/2
  - dirty_slot/2
  - dirty_update_counter/2
  - dirty_update_counter/3
  - dirty_write/1
  - dirty_write/2
  - dump_log/0
  - dump_tables/1
  - dump_to_textfile/1
  - error_description/1
  - ets/2
  - first/1
  - foldl/3
  - foldr/3
  - force_load_table/1
  - index_match_object/2
  - index_match_object/4
  - index_read/3
  - info/0
  - install_fallback/1
  - install_fallback/1
  - install_fallback/2
  - is_transaction/0
  - last/1
  - load_textfile/1
  - lock/2
  - match_object/1
  - match_object/3
  - move_table_copy/3
  - next/2
  - prev/2
  - read/1
  - read/2
  - read/3
  - read_lock_table/1
  - report_event/1
  - restore/2
  - s_delete/1
  - s_delete_object/1
  - s_write/1
  - schema/0
  - schema/1
  - select/2
  - select/4
  - select/1
  - set_debug_level/1
  - set_master_nodes/1
  - set_master_nodes/2
  - snmp_close_table/1
  - snmp_get_mnesia_key/2
  - snmp_get_next_index/2
  - snmp_get_row/2
  - snmp_open_table/2
  - start/0
  - stop/0
  - subscribe/1
  - sync_dirty/2
  - sync_transaction/3
  - system_info/1
  - table/1
  - table_info/2
  - transaction/2
  - transform_table/4
  - transform_table/3
  - traverse_backup/4
  - uninstall_fallback/0
  - uninstall_fallback/1
  - unsubscribe/1
  - wait_for_tables/2
  - wread/1
  - write/1
  - write/3
  - write_lock_table/1
- mnesia_frag_hash
  - Top of manual page
  - init_state/2
  - add_frag/1
  - del_frag/1
  - key_to_frag_number/2
  - match_spec_to_frag_numbers/2
- mnesia_registry
  - Top of manual page
  - create_table/1
  - create_table/2

# 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)