Db db = new Db(env, 0); db.open(null, "store.db", null, Db.DB_BTREE, dbOpenFlags, 0); DataStore store = new DataStore(db, keyFormat, valueFormat, keyAssigner); StoredMap map = new StoredMap(store, keyBinding, valueBinding, writeAllowed);
All access methods may be used with BDB. However, some access methods may only be used with certain types of collection views, and some access methods impose restrictions on the way collection views are used.
A store is always associated with the environment of its underlying database, which is the first parameter to the {Db#Db} constructor. There are three types of environments in Berkeley DB.
Environment | Access Mode | Berkeley DB Flags |
---|---|---|
Data Store | single-threaded access | Db.DB_INIT_MPOOL |
Concurrent Data Store | single-writer multiple-reader access | Db.DB_INIT_CDB | Db.DB_INIT_MPOOL |
Transactional Data Store | transactional access for any number of readers and writers | Db.DB_INIT_TXN | Db.DB_INIT_LOCK | Db.DB_INIT_MPOOL |
The flags shown are the minimum required for creating the Berkeley DB environment. Many other Berkeley DB options are also available. For details on creating and configuring the environment see the Berkeley DB documentation.
All three environments may be used within BDB. However, the Concurrent Data Store Environment imposes the restriction that only one writable cursor may be open at a time. This means that if you have a writable iterator for a data store open, then you cannot obtain another writable iterator for the same data store and you cannot perform other write operations through a collection for that data store (since this also uses a write cursor).
@author Mark Hayes Objects are identified by object IDs, which are positive long
s. Names are mapped to object IDs.
06/04, 2011 - Added support for Closeable
12/05, 2011 - Added JavaDoc comment
06/11, 2012 - Added getLength(K)
A newly created data store doesn't contain a single existing directory.
DataStores implementations should be thread safe.
A data store should be fully thread-safe, i.e. it should be possible to add and access data records concurrently. Optimally even separate processes should be able to concurrently access the data store with zero interprocess synchronization.
The following features are supported:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|