Class | BDB::Env |
In: |
env.rb
|
Parent: | Object |
Berkeley DB environment is an encapsulation of one or more databases, log files and shared information about the database environment such as shared memory buffer cache pages.
The simplest way to administer a Berkeley DB application environment is to create a single home directory that stores the files for the applications that will share the environment. The environment home directory must be created before any Berkeley DB applications are run. Berkeley DB itself never creates the environment home directory. The environment can then be identified by the name of that directory.
open the Berkeley DB environment
Proc given to set_feedback, set_app_dispatch and set_rep_transport can be also specified as a method (replace the prefix set_ with bdb_)
For bdb_rep_transport the constant ENVID must be defined
The constant BDB::ENCRYPT can be used to replace set_encrypt
begin a transaction (the transaction manager must be enabled). flags can have the value DBD::TXN_COMMIT, in this case the transaction will be commited at end.
The txn_checkpoint function flushes the underlying memory pool, writes a checkpoint record to the log and then flushes the log.
If either kbyte or min is non-zero, the checkpoint is only done if more than min minutes have passed since the last checkpoint, or if more than kbyte kilobytes of log data have been written since the last checkpoint.
only with BDB::VERSION_MAJOR == 4 && BDB::VERSION_MINOR >= 1
remove the database specified by file and database. If no database is nil, the underlying file represented by file is removed, incidentally removing all databases that it contained.
The flags value must be set to 0 or BDB::AUTO_COMMIT
only with BDB::VERSION_MAJOR == 4 && BDB::VERSION_MINOR >= 1
rename the database specified by file and database to newname. If database is nil, the underlying file represented by file is renamed, incidentally renaming all databases that it contained.
The flags value must be set to 0 or BDB::AUTO_COMMIT
Only for DB >= 4
Holds an election for the master of a replication group, returning the new master’s ID
Raise BDB::RepUnavail if the timeout expires
The lock_detect function runs one iteration of the deadlock detector. The deadlock detector traverses the lock table, and for each deadlock it finds, marks one of the participating transactions for abort.
type can have one the value BDB::LOCK_OLDEST, BDB::LOCK_RANDOM or BDB::LOCK_YOUNGUEST
flags can have the value BDB::LOCK_CONFLICT, in this case the deadlock detector is run only if a lock conflict has occurred since the last time that the deadlock detector was run.
return the number of transactions aborted by the lock_detect function if BDB::VERSION_MAJOR >= 3 or zero
The log_archive function return an array of log or database file names.
flags value must be set to 0 or the value BDB::ARCH_DATA, BDB::ARCH_ABS, BDB::ARCH_LOG
same as log_put(string, BDB::FLUSH)
Without argument, garantee that all records are written to the disk
open the database in the current environment. type must be one of the constant BDB::BTREE, BDB::HASH, BDB::RECNO, BDB::QUEUE. See open for other arguments
Only for DB >= 4
Processes an incoming replication message sent by a member of the replication group to the local database environment
only with BDB::VERSION_MAJOR == 3 && BDB::VERSION_MINOR >= 3
iterate over all prepared transactions. The transaction txn must be made a call to abort, commit, discard
id is the global transaction ID for the transaction
only with BDB::VERSION_MAJOR == 3 && BDB::VERSION_MINOR >= 2
flags can have the value BDB::CDB_ALLDB, BDB::NOMMAP BDB::TXN_NOSYNC
if onoff is false, the specified flags are cleared