Availability::- use_module(library(bdb)).
(can be autoloaded)
[det]bdb_init(+Options)
[det]bdb_init(-Environment,
+Options)Initialise a DB environment. The predicate bdb_init/1
initialises the default environment, while bdb_init/2
creates an explicit environment that can be passed to bdb_open/4
using the environment(+Environment)
option. If bdb_init/1
is called, it must be called before the first call to bdb_open/4
that uses the default environment. If bdb_init/1
is not called, the default environment can only handle plain files and
does not support multiple threads, locking, crash recovery, etc.
Initializing a BDB environment always requires the home(+Dir)
option. If the environment contains no databases, the argument
create(true)
must be supplied as well.
The currently supported options are listed below. The name of the
boolean options are derived from the DB flags by dropping the =DB_=
prefix and using lowercase, e.g. DB_INIT_LOCK
becomes init_lock
.
For details, please refer to the DB manual.
- create(+Bool)
- If
true
, create any underlying file as required. By
default, no new files are created. This option should be set for
prograns that create new databases.
- failchk(+Bool)
- home(+Home)
- Specify the DB home directory, the directory holding the database files.
The directory must exist prior to calling these predicates.
- init_lock(+Bool)
- Enable locking (
DB_INIT_LOCK
). Implied if transactions are
used.
- init_log(+Bool)
- Enable logging the DB modifications (
DB_INIT_LOG
). Logging
enables recovery of databases in case of system failure. Normally it is
used in combination with transactions.
- init_mpool(+Bool)
- Initialize memory pool. Impicit if
mp_size(+Size)
or
mp_mmapsize(+Size)
is specified.
- init_rep(+Bool)
- Init database replication. The rest of the replication logic is not yet
supported.
- init_txn(+Bool)
- Init transactions. Implies
init_log(true)
.
- lockdown(+Bool)
- mp_size(+Integer)
- mp_mmapsize(+Integer)
- Control memory pool handling (
DB_INIT_MPOOL
). The
mp_size
option sets the memory-pool used for caching, while
the mp_mmapsize
controls the maximum size of a DB file
mapped entirely into memory.
- private(+Bool)
- recover(+Bool)
- Perform recovery before opening the database.
- recover_fatal(+Bool)
- Perform fatal recovery before opening the database.
- register(+Bool)
- server(+Host, [+ServerOptions])
- Initialise the DB package for accessing a remote database. Host
specifies the name of the machine running
berkeley_db_svc
. Optionally additional options may be
specified:
- server_timeout(+Seconds)
- Specify the timeout time the server uses to determine that the client
has gone. This implies the server will terminate the connection to this
client if this client does not issue any requests for the indicated
time.
- client_timeout(+Seconds)
- Specify the time the client waits for the server to handle a request.
- system_mem(+Bool)
- transactions(+Bool)
- Enable transactions, providing atomicy of changes and security. Implies
logging and locking. See
bdb_transaction/1.
- thread(+Bool)
- Make the environment accessible from multiple threads.
- thread_count(+Integer)
- Declare an approximate number of threads in the database environment.
See
DB_ENV->set_thread_count()
.
- use_environ(+Bool)
- use_environ_root(+Bool)
- config(+ListOfConfig)
- Specify a list of configuration options, each option is of the form
Name(Value). Currently unused.