mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Let ejabberd_mnesia handles copy_type
This commit is contained in:
parent
0ea6c1dcf6
commit
94ac777f93
@ -98,14 +98,11 @@ init([]) ->
|
||||
update_tables(),
|
||||
ejabberd_mnesia:create(?MODULE, session,
|
||||
[{ram_copies, [node()]},
|
||||
{attributes, record_info(fields, session)}]),
|
||||
{attributes, record_info(fields, session)},
|
||||
{index, [usr,us]}]),
|
||||
ejabberd_mnesia:create(?MODULE, session_counter,
|
||||
[{ram_copies, [node()]},
|
||||
{attributes, record_info(fields, session_counter)}]),
|
||||
mnesia:add_table_index(session, usr),
|
||||
mnesia:add_table_index(session, us),
|
||||
mnesia:add_table_copy(session, node(), ram_copies),
|
||||
mnesia:add_table_copy(session_counter, node(), ram_copies),
|
||||
mnesia:subscribe(system),
|
||||
{ok, #state{}}.
|
||||
|
||||
|
@ -49,9 +49,9 @@ init(_Host, Opts) ->
|
||||
ejabberd_mnesia:create(?MODULE, muc_registered,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes,
|
||||
record_info(fields, muc_registered)}]),
|
||||
update_tables(MyHost),
|
||||
mnesia:add_table_index(muc_registered, nick).
|
||||
record_info(fields, muc_registered)},
|
||||
{index, [nick]}]),
|
||||
update_tables(MyHost).
|
||||
|
||||
store_room(_LServer, Host, Name, Opts) ->
|
||||
F = fun () ->
|
||||
|
@ -42,14 +42,14 @@
|
||||
init(_Host, _Opts) ->
|
||||
ejabberd_mnesia:create(?MODULE, roster,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes, record_info(fields, roster)}]),
|
||||
{attributes, record_info(fields, roster)},
|
||||
{index, [us]}]),
|
||||
ejabberd_mnesia:create(?MODULE, roster_version,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes,
|
||||
record_info(fields, roster_version)}]),
|
||||
update_tables(),
|
||||
mnesia:add_table_index(roster, us),
|
||||
mnesia:add_table_index(roster_version, us).
|
||||
record_info(fields, roster_version)},
|
||||
{index, [us]}]),
|
||||
update_tables().
|
||||
|
||||
read_roster_version(LUser, LServer) ->
|
||||
US = {LUser, LServer},
|
||||
|
@ -47,9 +47,9 @@ init(_Host, _Opts) ->
|
||||
{attributes, record_info(fields, sr_group)}]),
|
||||
ejabberd_mnesia:create(?MODULE, sr_user,
|
||||
[{disc_copies, [node()]}, {type, bag},
|
||||
{attributes, record_info(fields, sr_user)}]),
|
||||
update_tables(),
|
||||
mnesia:add_table_index(sr_user, group_host).
|
||||
{attributes, record_info(fields, sr_user)},
|
||||
{index, [group_host]}]),
|
||||
update_tables().
|
||||
|
||||
list_groups(Host) ->
|
||||
mnesia:dirty_select(sr_group,
|
||||
|
@ -181,10 +181,8 @@ init([]) ->
|
||||
ejabberd_mnesia:create(?MODULE, sip_session,
|
||||
[{ram_copies, [node()]},
|
||||
{type, bag},
|
||||
{attributes, record_info(fields, sip_session)}]),
|
||||
mnesia:add_table_index(sip_session, conn_mref),
|
||||
mnesia:add_table_index(sip_session, socket),
|
||||
mnesia:add_table_copy(sip_session, node(), ram_copies),
|
||||
{attributes, record_info(fields, sip_session)},
|
||||
{index, [conn_mref,socket]}]),
|
||||
{ok, #state{}}.
|
||||
|
||||
handle_call({write, Sessions, Supported}, _From, State) ->
|
||||
|
@ -46,20 +46,13 @@ init(_Host, _Opts) ->
|
||||
ejabberd_mnesia:create(?MODULE, vcard_search,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes,
|
||||
record_info(fields, vcard_search)}]),
|
||||
update_tables(),
|
||||
mnesia:add_table_index(vcard_search, luser),
|
||||
mnesia:add_table_index(vcard_search, lfn),
|
||||
mnesia:add_table_index(vcard_search, lfamily),
|
||||
mnesia:add_table_index(vcard_search, lgiven),
|
||||
mnesia:add_table_index(vcard_search, lmiddle),
|
||||
mnesia:add_table_index(vcard_search, lnickname),
|
||||
mnesia:add_table_index(vcard_search, lbday),
|
||||
mnesia:add_table_index(vcard_search, lctry),
|
||||
mnesia:add_table_index(vcard_search, llocality),
|
||||
mnesia:add_table_index(vcard_search, lemail),
|
||||
mnesia:add_table_index(vcard_search, lorgname),
|
||||
mnesia:add_table_index(vcard_search, lorgunit).
|
||||
record_info(fields, vcard_search)},
|
||||
{index, [ luser, lfn, lfamily,
|
||||
lgiven, lmiddle, lnickname,
|
||||
lbday, lctry, llocality,
|
||||
lemail, lorgname, lorgunit
|
||||
]}]),
|
||||
update_tables().
|
||||
|
||||
stop(_Host) ->
|
||||
ok.
|
||||
|
@ -51,13 +51,8 @@
|
||||
init(_Host, _ServerHost, _Options) ->
|
||||
ejabberd_mnesia:create(?MODULE, pubsub_node,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes, record_info(fields, pubsub_node)}]),
|
||||
mnesia:add_table_index(pubsub_node, id),
|
||||
NodesFields = record_info(fields, pubsub_node),
|
||||
case mnesia:table_info(pubsub_node, attributes) of
|
||||
NodesFields -> ok;
|
||||
_ -> ok
|
||||
end,
|
||||
{attributes, record_info(fields, pubsub_node)},
|
||||
{index, [id]}]),
|
||||
%% mnesia:transform_table(pubsub_state, ignore, StatesFields)
|
||||
ok.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user