1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.2 -->
<HTML>
<HEAD>
<TITLE>IDL Specification of Mnesia (CORBA) Session</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<CENTER>
<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif"></A>
</CENTER>
<A NAME="3"><!-- Empty --></A>
<H2>3 IDL Specification of Mnesia (CORBA) Session</H2>
<A NAME="3.1"><!-- Empty --></A>
<H3>3.1 mnesia_session.idl</H3>
<P>
<PRE>
// ``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 Session - IDL interface to Mnesia
//////////////////////////////////////////////////////////////////
#include <erlang.idl>
// All types are enclosed by the mnesia module
module mnesia
{
///////////////////////////////////////////////////////////////
// Status - a general type for keeping track of
// the outcome of the session related functions.
enum Status
{
// Success codes:
ok, // The operation was successful and
// the all out parameters except 'reason'
// contains valid data.
end_of_table, // End of table has been reached.
// This return code is only used by
// a few functions, such as dirty_slot/4,
// dirty_first/3, dirty_next/4 ...
// Failure codes:
timeout, // This return code is only used by
// wait_for_table.
error // Miscellaneous error.
// Operation did not succeed and the out
// parameter 'reason' contains a description
// of the error. The other out parameters
// contains garbage.
// In future releases we will probably expand this enum
// with more precise error codes like no_exists, badarg etc.
};
// Record - an erlang record, i.e. a tagged tuple with the
// following layout: {tab_name, key, attr_1, ... attr_N}
typedef erlang::term Record;
typedef sequence <Record> Recordlist;
// TableName - a name of a table. Note that the character '_'
// should be avoided if the table is intended to be used
// via the Corba Session.
typedef string TableName;
typedef sequence <TableName> TableList;
// Key - a key of a record
typedef erlang::term Key;
typedef sequence <Key> KeyList;
// Indecies - list of index positions.
// In the sample record above, attr_1 has position 3
typedef sequence <long> Indices;
// AttrNames - a list of attribute names
typedef sequence <string> AttrNames;
// RecordName - Type information
typedef string RecordName;
// Node - an Erlang node, e.g. "name1@host[.org.country]"
typedef string Node;
typedef sequence <Node> NodeList;
// Storage - table storage type
enum Storage {ram_copies, disc_copies, disc_only_copies};
// SetOrBag - table type
enum SetOrBag {set, bag};
// AccessMode - controls the accessibility of a table
enum AccessMode {read_only, read_write};
// Checkpoints - a list of checkpoint names
typedef sequence <string> Checkpoints;
///////////////////////////////////////////////////////////////
// TableDef - initial specification of a table
struct TableDef
{
SetOrBag type;
AccessMode mode;
NodeList ram_copies;
NodeList disc_copies;
NodeList disc_only_copies;
Indices index_list;
AttrNames attributes;
RecordName record_name;
};
///////////////////////////////////////////////////////////////
// CheckpointDef - initial specification of a checkpoint
struct CheckpointDef
{
string cpName;
TableList max;
TableList min;
boolean allow_remote;
boolean ram_overrides_dump;
};
///////////////////////////////////////////////////////////////
// TableInfo - information about a table
struct TableInfo
{
AccessMode mode;
AttrNames attributes;
long arity;
Checkpoints checkpoints;
NodeList ram_copies;
NodeList disc_copies;
NodeList disc_only_copies;
Indices indexlist;
long load_order;
boolean local_content;
NodeList master_nodes;
long memory;
long size;
Storage storage_type;
SetOrBag type;
Node where_to_read;
NodeList where_to_write;
RecordName record_name;
// Not supported: cookie, snmp, subscribers, version, wild_pattern
};
///////////////////////////////////////////////////////////////
// SystemInfo - information about the Mnesia system
// Some info can always be determined, but
// other info is only valid if Mnesia is running.
struct SystemInfo
{
// The following information is always determined by
// system_info/2:
boolean auto_repair;
string backup_module;
string event_module;
NodeList db_nodes;
string debug;
string directory;
boolean dump_log_load_regulation;
long dump_log_time_threshold;
boolean dump_log_update_in_place;
long dump_log_write_threshold;
NodeList extra_db_nodes;
boolean is_running;
string schema_location;
boolean use_dir;
// Not supported: log_version, protocol_version, version
// The following information is only valid if Mnesia is running.
// Check 'is_running' before the info is accessed and regard the
// values as undefined if 'is_running' is false.
Checkpoints checkpoints;
boolean fallback_activated;
TableList local_tables;
TableList master_node_tables;
NodeList running_db_nodes;
TableList tables;
long transaction_failures;
long transaction_commits;
long transaction_restarts;
long transaction_log_writes;
// Not supported: held_locks, lock_queue, communication protocol,
// subscribers, transactions
};
///////////////////////////////////////////////////////////////
// Most of the following functions returns Status and in case of
// an error, the out parameter 'reason' contains the description
// of the cause and all other out parameters contains undefined values.
//
// If the function was successful, 'reason' contains an empty string
// and the other out parameters contains valid data.
interface session
{
///////////////////////////////////////////////////////////////
// Dirty access functions
Status dirty_write( in TableName tab,
in Record object,
out string reason);
Status dirty_read( in TableName tab,
in Key key,
out Recordlist result,
out string reason);
Status dirty_update_counter(in TableName tab,
in Key key,
in long val,
out long newval,
out string reason);
Status dirty_delete( in TableName tab,
in Key key,
out string reason);
Status dirty_delete_object( in TableName tab,
in Record object,
out string reason);
Status dirty_slot( in TableName tab,
in long slot,
out Recordlist result,
out string reason);
Status dirty_first( in TableName tab,
out Key next_key,
out string reason);
Status dirty_next( in TableName tab,
in Key key,
out Key next_key,
out string reason);
Status dirty_all_keys( in TableName tab,
out KeyList keys,
out string reason);
Status dirty_match_all( in TableName tab,
out Recordlist result,
out string reason);
Status dirty_index_read( in TableName tab,
in Key key,
in long pos,
out Recordlist result,
out string reason);
///////////////////////////////////////////////////////////////
// Table management
Status create_table( in TableName tab,
in TableDef tabDefs,
out string reason);
Status delete_table( in TableName tab,
out string reason);
Status add_table_copy( in TableName tab,
in Node node,
in Storage type,
out string reason);
Status del_table_copy( in TableName tab,
in Node node,
out string reason);
Status move_table_copy( in TableName tab,
in Node from,
in Node to,
out string reason);
Status add_table_index( in TableName tab,
in long attrname,
out string reason);
Status del_table_index( in TableName tab,
in long attrname,
out string reason);
Status change_table_copy_type( in TableName tab,
in Node node,
in Storage type,
out string reason);
Status change_table_access_mode(in TableName tab,
in AccessMode mode,
out string reason);
///////////////////////////////////////////////////////////////
// Table load
Status wait_for_tables( in TableList tabs,
in long timeout,
out TableList failed_tabs,
out string reason);
Status force_load_table( in TableName tab,
out string reason);
Status change_table_load_order(in TableName tab,
in long load_order,
out string reason);
Status set_master_nodes1( in NodeList nodes,
out string reason);
Status set_master_nodes2( in TableName tab,
in NodeList nodes,
out string reason);
///////////////////////////////////////////////////////////////
// Database management
Status backup1( in string filename,
out string reason);
Status backup2( in erlang::term opaque,
in string modulename,
out string reason);
Status install_fallback1( in string filename,
out string reason);
Status install_fallback2( in erlang::term opaque,
in string modulename,
out string reason);
Status uninstall_fallback( out string reason);
Status dump_log( out string reason);
Status dump_tables( in TableList list,
out string reason);
Status activate_checkpoint( in CheckpointDef cpdef,
out string reason);
Status deactivate_checkpoint(in string cpName,
out string reason);
Status backup_checkpoint1( in string cpName,
in string filename,
out string reason);
Status backup_checkpoint2( in string cpName,
in erlang::term opaque,
in string modulename,
out string reason);
///////////////////////////////////////////////////////////////
// Miscellaneous
Status load_textfile( in string filename,
out string reason);
Status dump_to_textfile(in string filename,
out string reason);
Status table_info( in TableName tab,
out TableInfo info,
out string reason);
Status system_info( out SystemInfo info,
out string reason);
///////////////////////////////////////////////////////////////
// match_object functions is not supported due to the fact that
// erlang::term is represented as an 'any' object and can not
// be handled in an ordinary way in corba
Status dirty_match_object( in TableName Tab,
in Record pattern,
out Recordlist result,
out string reason);
Status dirty_index_match_object(in TableName Tab,
in Record pattern,
in long pos,
out Recordlist result,
out string reason);
///////////////////////////////////////////////////////////////
// Functions that deals with starting and stopping the Mnesia
// application or operates when Mnesia is not running is not
// supported in the corba interface due to fact that Orber
// needs a running Mnesia in order to operate.
Status create_schema( in NodeList nodes,
out string reason);
Status delete_schema( in NodeList nodes,
out string reason);
Status start_mnesia(out string reason);
Status stop_mnesia( out string reason);
};
//////////////////////////////////////////////////////////////////
// The connector process registers itself in the local Erlang node
// at startup of the Mnesia Session application
interface connector
{
// Connects to Mnesia on the same Erlang node as the
// Connector process, creates a Session process and returns
// its process identifier.
erlang::pid connect();
// Disconnects from Mnesia and terminates
// the Session process.
void disconnect(in erlang::pid object_key);
};
};
</PRE>
<CENTER>
<HR>
<SMALL>
Copyright © 1991-2004
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|