From: <mi...@us...> - 2003-05-12 08:26:33
|
Update of /cvsroot/jungerl/jungerl/lib/rdbms/priv In directory sc8-pr-cvs1:/tmp/cvs-serv4317/priv Added Files: README mnesia.hrl mnesia_schema.erl Log Message: rdbms-1.3 --- NEW FILE: README --- Those files are only needed if you are using a version of Erlang prior to R7B. Move them to the src/ directory before compilation if you need them. --- NEW FILE: mnesia.hrl --- %% ``The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved via the world wide web at http://www.erlang.org/. %% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings %% AB. All Rights Reserved.'' %% %% $Id: mnesia.hrl,v 1.1 2003/05/12 08:26:29 mikl Exp $ %% -define(APPLICATION, mnesia). %-define(use_db_bifs, true). %% When uncommenting,remember to modify mnesia_lib:erlang_db_match_ob -ifdef(use_db_bifs). -define(ets_lookup(Tab, Key), erlang:db_get(Tab, Key)). -define(ets_lookup_element(Tab, Key, Pos), erlang:db_get_element(Tab, Key, Pos)). -define(ets_insert(Tab, Rec), erlang:db_put(Tab, Rec)). -define(ets_delete(Tab, Key), erlang:db_erase(Tab, Key)). -define(ets_match_delete(Tab, Pat), erlang:db_match_erase(Tab, Pat)). -define(ets_match_object(Tab, Pat), mnesia_lib:erlang_db_match_object(Tab, Pat)). -define(ets_match(Tab, Pat), erlang:db_match(Tab, Pat)). -define(ets_info(Tab, Item), erlang:db_info(Tab, Item)). -define(ets_update_counter(Tab, Key, Incr), erlang:db_update_counter(Tab, Key, Incr)). -define(ets_first(Tab), erlang:db_first(Tab)). -define(ets_next(Tab, Key), erlang:db_next_key(Tab, Key)). -define(ets_slot(Tab, Pos), erlang:db_slot(Tab, Pos)). -define(ets_new_table(Tab, Props), erlang:db_create(Tab, Props)). -define(ets_delete_table(Tab), erlang:db_erase(Tab)). -define(ets_fixtable(Tab, Bool), erlang:db_fixtable(Tab, Bool)). -else. -define(ets_lookup(Tab, Key), ets:lookup(Tab, Key)). %% -define(ets_lookup_element(Tab, Key, Pos), erlang:db_get_element(Tab, Key, Pos)). -define(ets_lookup_element(Tab, Key, Pos), ets:lookup_element(Tab, Key, Pos)). -define(ets_insert(Tab, Rec), ets:insert(Tab, Rec)). -define(ets_delete(Tab, Key), ets:delete(Tab, Key)). -define(ets_match_delete(Tab, Pat), ets:match_delete(Tab, Pat)). -define(ets_match_object(Tab, Pat), ets:match_object(Tab, Pat)). -define(ets_match(Tab, Pat), ets:match(Tab, Pat)). -define(ets_info(Tab, Item), ets:info(Tab, Item)). -define(ets_update_counter(Tab, Key, Incr), ets:update_counter(Tab, Key, Incr)). -define(ets_first(Tab), ets:first(Tab)). -define(ets_next(Tab, Key), ets:next(Tab, Key)). -define(ets_slot(Tab, Pos), ets:slot(Tab, Pos)). -define(ets_new_table(Tab, Props), ets:new(Tab, Props)). %% -define(ets_new_table(Tab, Props), erlang:db_create(Tab, Props)). -define(ets_delete_table(Tab), ets:delete(Tab)). -define(ets_fixtable(Tab, Bool), ets:fixtable(Tab, Bool)). -endif. -define(catch_val(Var), (catch ?ets_lookup_element(mnesia_gvar, Var, 2))). %% It's important that counter is first, since we compare tid's -record(tid, {counter, %% serial no for tid pid}). %% owner of tid -record(tidstore, {store, %% current ets table for tid up_stores = [], %% list of upper layer stores for nested trans level = 1}). %% transaction level -define(unique_cookie, {erlang:now(), node()}). -record(cstruct, {name, % Atom type = set, % set | bag ram_copies = [], % [Node] disc_copies = [], % [Node] disc_only_copies = [], % [Node] load_order = 0, % Integer access_mode = read_write, % read_write | read_only index = [], % [Integer] snmp = [], % Snmp Ustruct local_content = false, % true | false record_name = {bad_record_name}, % Atom (Default = Name) attributes = [key, val], % [Atom] user_properties = [], % [Record] frag_properties = [], % [{Key, Val] cookie = ?unique_cookie, % Term version = {{2, 0}, []}}). % {{Integer, Integer}, [Node]} %% Record for the head structure in Mnesia's log files %% %% The definition of this record may *NEVER* be changed %% since it may be written to very old backup files. %% By holding this record definition stable we can be %% able to comprahend backups from timepoint 0. It also %% allows us to use the backup format as an interchange %% format between Mnesia releases. -record(log_header,{log_kind, log_version, mnesia_version, node, now}). %% Commit records stored in the transaction log -record(commit, {node, decision, % presume_commit | Decision ram_copies = [], disc_copies = [], disc_only_copies = [], snmp = [], schema_ops = [] }). -record(decision, {tid, outcome, % presume_abort | committed disc_nodes, ram_nodes}). %% Maybe cyclic wait -record(cyclic, {node = node(), oid, % {Tab, Key} op, % read | write lock, % read | write lucky }). %% Managing conditional debug functions -ifdef(debug). -define(eval_debug_fun(I, C), mnesia_lib:eval_debug_fun(I, C, ?FILE, ?LINE)). -else. -define(eval_debug_fun(I, C), ok). -endif. --- NEW FILE: mnesia_schema.erl --- %% ``The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved via the world wide web at http://www.erlang.org/. %% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings %% AB. All Rights Reserved.'' %% %% $Id: mnesia_schema.erl,v 1.1 2003/05/12 08:26:29 mikl Exp $ %% %% Modified by Ulf Wiger <ulf...@er...> 1999-12-18 to allow %% more flexible adminitration of user properties. [...2671 lines suppressed...] {L1, L2} = mnesia_recover:connect_nodes([N]), case lists:member(N, L1) or lists:member(N, L2) of true -> mnesia_lib:add({current, db_nodes}, N), mnesia_controller:add_active_replica(schema, N, SchemaCs); false -> ignore end, announce_im_running(Ns, SchemaCs); announce_im_running([], _) -> []. unannounce_im_running([N | Ns]) -> mnesia_lib:del({current, db_nodes}, N), mnesia_controller:del_active_replica(schema, N), mnesia_recover:disconnect_node(N), unannounce_im_running(Ns); unannounce_im_running([]) -> []. |