oasys::BerkeleyDBStore Class Reference

#include <BerkeleyDBStore.h>

Inheritance diagram for oasys::BerkeleyDBStore:

oasys::DurableStoreImpl oasys::Logger List of all members.

Detailed Description

Interface for the generic datastore.

Definition at line 47 of file BerkeleyDBStore.h.

Public Member Functions

 BerkeleyDBStore (const char *logpath)
BerkeleyDBStoreoperator= (const BerkeleyDBStore &)
 BerkeleyDBStore (const BerkeleyDBStore &)
 ~BerkeleyDBStore ()
int init (const StorageConfig &cfg)
 Virtual from DurableStoreImpl Initialize BerkeleyDBStore.
int get_table (DurableTableImpl **table, const std::string &name, int flags, PrototypeVector &prototypes)
 Virtual from DurableStoreImpl Initialize BerkeleyDBStore.
int del_table (const std::string &name)
 Virtual from DurableStoreImpl Initialize BerkeleyDBStore.
int get_table_names (StringVector *names)
 Virtual from DurableStoreImpl Initialize BerkeleyDBStore.
std::string get_info () const
 Virtual from DurableStoreImpl Initialize BerkeleyDBStore.

Private Member Functions

int get_meta_table (BerkeleyDBTable **table)
 Get meta-table.
int acquire_table (const std::string &table)
 Changes the ref count on the tables, used by BerkeleyDBTable.
int release_table (const std::string &table)
 Changes the ref count on the tables, used by BerkeleyDBTable.

Static Private Member Functions

static void db_errcall (const char *errpfx, char *msg)
 DB internal error log callback (unfortunately, the function signature changed between 4.2 and 4.3).
static void db_panic (DB_ENV *dbenv, int errval)
 DB internal panic callback.

Private Attributes

bool init_
 Initialized?
std::string db_name_
 Name of the database file.
DB_ENV * dbenv_
 database environment for all tables
bool sharefile_
 share a single db file
SpinLock ref_count_lock_
RefCountMap ref_count_
 Ref. count for open tables.
DeadlockTimerdeadlock_timer_

Static Private Attributes

static const std::string META_TABLE_NAME
 Id that represents the metatable of tables.

Friends

class BerkeleyDBTable

Classes

class  DeadlockTimer
 Timer class used to periodically check for deadlocks. More...


Constructor & Destructor Documentation

oasys::BerkeleyDBStore::BerkeleyDBStore ( const char *  logpath  ) 

Definition at line 46 of file BerkeleyDBStore.cc.

oasys::BerkeleyDBStore::BerkeleyDBStore ( const BerkeleyDBStore  ) 

oasys::BerkeleyDBStore::~BerkeleyDBStore (  ) 

Definition at line 52 of file BerkeleyDBStore.cc.

References oasys::StringBuffer::append(), oasys::StringBuffer::appendf(), oasys::StringBuffer::c_str(), dbenv_, deadlock_timer_, log_err, log_info, and ref_count_.


Member Function Documentation

BerkeleyDBStore& oasys::BerkeleyDBStore::operator= ( const BerkeleyDBStore  ) 

int oasys::BerkeleyDBStore::init ( const StorageConfig cfg  )  [virtual]

Virtual from DurableStoreImpl Initialize BerkeleyDBStore.

Implements oasys::DurableStoreImpl.

Definition at line 85 of file BerkeleyDBStore.cc.

References oasys::FileUtils::abspath(), oasys::DurableStoreImpl::check_db_dir(), oasys::DurableStoreImpl::create_db_dir(), db_errcall(), oasys::StorageConfig::db_lockdetect_, oasys::StorageConfig::db_log_, oasys::StorageConfig::db_mpool_, db_name_, db_panic(), oasys::StorageConfig::db_sharefile_, oasys::StorageConfig::db_txn_, oasys::StorageConfig::dbdir_, dbenv_, oasys::StorageConfig::dbname_, deadlock_timer_, oasys::DS_ERR, init_, oasys::StorageConfig::init_, log_crit, log_info, oasys::Logger::logpath_, oasys::DurableStoreImpl::prune_db_dir(), oasys::BerkeleyDBStore::DeadlockTimer::reschedule(), SET_DBENV_OPTION, sharefile_, oasys::StorageConfig::tidy_, and oasys::StorageConfig::tidy_wait_.

int oasys::BerkeleyDBStore::get_table ( DurableTableImpl **  table,
const std::string &  name,
int  flags,
PrototypeVector prototypes 
)

Virtual from DurableStoreImpl Initialize BerkeleyDBStore.

Definition at line 213 of file BerkeleyDBStore.cc.

References ASSERT, BerkeleyDBTable, db_name_, dbenv_, deadlock_timer_, oasys::DS_BTREE, oasys::DS_CREATE, oasys::DS_ERR, oasys::DS_EXCL, oasys::DS_EXISTS, oasys::DS_HASH, oasys::DS_MULTITYPE, oasys::DS_NOTFOUND, init_, log_debug, log_err, log_warn, oasys::Logger::logpath_, NO_TX, and sharefile_.

int oasys::BerkeleyDBStore::del_table ( const std::string &  name  )  [virtual]

Virtual from DurableStoreImpl Initialize BerkeleyDBStore.

Implements oasys::DurableStoreImpl.

Definition at line 325 of file BerkeleyDBStore.cc.

References ASSERT, db_name_, dbenv_, oasys::DS_BUSY, oasys::DS_ERR, oasys::DS_NOTFOUND, init_, log_err, log_info, NO_TX, ref_count_, and sharefile_.

int oasys::BerkeleyDBStore::get_table_names ( StringVector names  )  [virtual]

Virtual from DurableStoreImpl Initialize BerkeleyDBStore.

Implements oasys::DurableStoreImpl.

Definition at line 370 of file BerkeleyDBStore.cc.

References oasys::BerkeleyDBTable::db_, oasys::DBTRef::dbt(), delete_z, oasys::DS_ERR, oasys::DS_OK, get_meta_table(), log_err, NO_TX, NOTIMPLEMENTED, and sharefile_.

std::string oasys::BerkeleyDBStore::get_info (  )  const [virtual]

Virtual from DurableStoreImpl Initialize BerkeleyDBStore.

Implements oasys::DurableStoreImpl.

Definition at line 435 of file BerkeleyDBStore.cc.

int oasys::BerkeleyDBStore::get_meta_table ( BerkeleyDBTable **  table  )  [private]

Get meta-table.

Definition at line 444 of file BerkeleyDBStore.cc.

References ASSERT, BerkeleyDBTable, db_name_, dbenv_, oasys::DS_ERR, init_, log_err, oasys::Logger::logpath_, META_TABLE_NAME, NO_TX, and sharefile_.

Referenced by get_table_names().

int oasys::BerkeleyDBStore::acquire_table ( const std::string &  table  )  [private]

Changes the ref count on the tables, used by BerkeleyDBTable.

Definition at line 484 of file BerkeleyDBStore.cc.

References ASSERT, init_, log_debug, and ref_count_.

Referenced by oasys::BerkeleyDBTable::BerkeleyDBTable().

int oasys::BerkeleyDBStore::release_table ( const std::string &  table  )  [private]

Changes the ref count on the tables, used by BerkeleyDBTable.

Definition at line 498 of file BerkeleyDBStore.cc.

References ASSERT, init_, log_debug, and ref_count_.

Referenced by oasys::BerkeleyDBTable::~BerkeleyDBTable().

void oasys::BerkeleyDBStore::db_errcall ( const char *  errpfx,
char *  msg 
) [static, private]

DB internal error log callback (unfortunately, the function signature changed between 4.2 and 4.3).

Definition at line 526 of file BerkeleyDBStore.cc.

References log_err_p.

Referenced by init().

void oasys::BerkeleyDBStore::db_panic ( DB_ENV *  dbenv,
int  errval 
) [static, private]

DB internal panic callback.

Definition at line 536 of file BerkeleyDBStore.cc.

Referenced by init().


Friends And Related Function Documentation

friend class BerkeleyDBTable [friend]

Definition at line 48 of file BerkeleyDBStore.h.

Referenced by get_meta_table(), and get_table().


Member Data Documentation

bool oasys::BerkeleyDBStore::init_ [private]

Initialized?

Definition at line 74 of file BerkeleyDBStore.h.

Referenced by acquire_table(), del_table(), get_meta_table(), get_table(), init(), and release_table().

std::string oasys::BerkeleyDBStore::db_name_ [private]

Name of the database file.

Definition at line 75 of file BerkeleyDBStore.h.

Referenced by del_table(), get_meta_table(), get_table(), and init().

DB_ENV* oasys::BerkeleyDBStore::dbenv_ [private]

database environment for all tables

Definition at line 76 of file BerkeleyDBStore.h.

Referenced by del_table(), get_meta_table(), get_table(), init(), and ~BerkeleyDBStore().

bool oasys::BerkeleyDBStore::sharefile_ [private]

share a single db file

Definition at line 77 of file BerkeleyDBStore.h.

Referenced by del_table(), get_meta_table(), get_table(), get_table_names(), and init().

SpinLock oasys::BerkeleyDBStore::ref_count_lock_ [private]

Definition at line 79 of file BerkeleyDBStore.h.

RefCountMap oasys::BerkeleyDBStore::ref_count_ [private]

Ref. count for open tables.

Definition at line 80 of file BerkeleyDBStore.h.

Referenced by acquire_table(), del_table(), release_table(), and ~BerkeleyDBStore().

const std::string oasys::BerkeleyDBStore::META_TABLE_NAME [static, private]

Id that represents the metatable of tables.

Definition at line 83 of file BerkeleyDBStore.h.

Referenced by get_meta_table().

DeadlockTimer* oasys::BerkeleyDBStore::deadlock_timer_ [private]

Definition at line 126 of file BerkeleyDBStore.h.

Referenced by get_table(), init(), and ~BerkeleyDBStore().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 16:57:01 2007 for DTN Reference Implementation by  doxygen 1.5.1