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