diff options
| author | Matthew Sackman <matthew@rabbitmq.com> | 2010-12-08 15:57:42 +0000 |
|---|---|---|
| committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-12-08 15:57:42 +0000 |
| commit | 61d670551c4ef4cb447549dc7273ee47e5ac1b09 (patch) | |
| tree | 63ae789852090f6bcfaf8db674e1dba571615e0e /src | |
| parent | b02c6c8792fde10065127fbec9e5727fda222fc8 (diff) | |
| download | rabbitmq-server-git-61d670551c4ef4cb447549dc7273ee47e5ac1b09.tar.gz | |
Provide a means for plugins to add extra tables which are looked after by rabbit_mnesia
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mnesia.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index a62e7a6f47..65404aae51 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -34,7 +34,8 @@ -export([ensure_mnesia_dir/0, dir/0, status/0, init/0, is_db_empty/0, cluster/1, force_cluster/1, reset/0, force_reset/0, - is_clustered/0, empty_ram_only_tables/0, copy_db/1]). + is_clustered/0, empty_ram_only_tables/0, copy_db/1, + add_table_definition/1]). -export([table_names/0]). @@ -210,7 +211,18 @@ table_definitions() -> {rabbit_queue, [{record_name, amqqueue}, {attributes, record_info(fields, amqqueue)}, - {match, #amqqueue{name = queue_name_match(), _='_'}}]}]. + {match, #amqqueue{name = queue_name_match(), _='_'}}]}] + ++ plugin_table_definitions(). + +add_table_definition(Def) -> + ok = application:set_env(rabbit, plugin_mnesia_tables, + [Def | plugin_table_definitions()], infinity). + +plugin_table_definitions() -> + case application:get_env(rabbit, plugin_mnesia_tables) of + {ok, Defs} -> Defs; + undefined -> [] + end. binding_match() -> #binding{source = exchange_name_match(), |
