mnesia developments
Vance Shipley
vances@REDACTED
Wed Jun 4 16:11:42 CEST 2003
Perhaps an example:
-module(install).
-export([start/0]).
start() ->
mnesia:create_schema([node()]),
application:start(mnesia),
mnesia:wait_for_tables([schema], 10000),
mnesia:create_table(ds1Table, [{snmp, [{key, integer}]},
{attributes, [index, name, type]}]),
mnesia:wait_for_tables([ds1Table], 10000),
eva_sup:create_tables_log_snmp([node()]),
mnesia:wait_for_tables([eventTable, alarmTable, alarm,
eva_snmp_map, evaLogDiscriminatorTable,
logTable, logTransferTable], 10000).
Note the wait_for_tables/2 calls. This non-obvious step is important.
In this example we're creating tables for snmp.
(foo@REDACTED)1> c(install).
{ok,install}
(foo@REDACTED)2> install:start().
ok
This creates a directory named Mnesia.foo@REDACTED which now
contains:
LATEST.LOG logTable.DCD
alarmTable.DCD logTransferTable.DCD
evaLogDiscriminatorTable.DCD schema.DAT
eventTable.DCD
This directory can be configured in your sys.config file:
{mnesia, [{dir, "lib/erlang/lib/bar-0.1/priv/data"}]}
-Vance
More information about the erlang-questions
mailing list