dtn::GlobalStore Class Reference

#include <GlobalStore.h>

Inheritance diagram for dtn::GlobalStore:

oasys::Logger dtn::SQLGlobalStore List of all members.

Detailed Description

Class for those elements of the router that need to be persistently stored but are singleton global values.

Examples include the running sequence number for bundles and registrations, as well as any other persistent configuration settings.

Definition at line 63 of file GlobalStore.h.

Public Member Functions

 GlobalStore ()
 Constructor.
int do_init (const oasys::StorageConfig &cfg, oasys::DurableStore *store)
 Real initialization method.
 ~GlobalStore ()
 Destructor.
u_int32_t next_bundleid ()
 Get a new bundle id, updating the value in the store.
u_int32_t next_regid ()
 Get a new unique registration id, updating the running value in the persistent table.
bool load ()
 Load in the globals.
void close ()
 Close (and flush) the data store.

Static Public Member Functions

static GlobalStoreinstance ()
 Singleton instance accessor.
static int init (const oasys::StorageConfig &cfg, oasys::DurableStore *store)
 Boot time initializer.
static bool initialized ()
 Return true if initialization has completed.

Static Public Attributes

static const u_int32_t CURRENT_VERSION

Protected Member Functions

void update ()
 Update the globals in the store.

Protected Attributes

bool loaded_
Globalsglobals_
oasys::SingleTypeDurableTable<
Globals > * 
store_
oasys::Mutexlock_

Static Protected Attributes

static GlobalStoreinstance_
 singleton instance


Constructor & Destructor Documentation

dtn::GlobalStore::GlobalStore (  ) 

Constructor.

Definition at line 80 of file GlobalStore.cc.

References lock_, oasys::Logger::logpath_, and oasys::Mutex::TYPE_RECURSIVE.

Referenced by init().

dtn::GlobalStore::~GlobalStore (  ) 

Destructor.

Definition at line 157 of file GlobalStore.cc.

References globals_, lock_, and store_.


Member Function Documentation

static GlobalStore* dtn::GlobalStore::instance (  )  [inline, static]

Singleton instance accessor.

Definition at line 70 of file GlobalStore.h.

References instance_.

Referenced by dtn::Bundle::Bundle(), dtn::DTNServer::close_datastore(), dtn::APIClient::handle_register(), and dtn::DTNServer::init_datastore().

int dtn::GlobalStore::init ( const oasys::StorageConfig cfg,
oasys::DurableStore store 
) [static]

Boot time initializer.

Definition at line 90 of file GlobalStore.cc.

References do_init(), GlobalStore(), and instance_.

Referenced by dtn::DTNServer::init_datastore().

int dtn::GlobalStore::do_init ( const oasys::StorageConfig cfg,
oasys::DurableStore store 
)

Real initialization method.

Definition at line 103 of file GlobalStore.cc.

References __log_err, CURRENT_VERSION, oasys::DS_CREATE, oasys::DS_EXCL, oasys::DS_EXISTS, oasys::DS_NOTFOUND, oasys::DurableStore::get_table(), dtn::GLOBAL_KEY, dtn::GLOBAL_TABLE, globals_, oasys::StorageConfig::init_, loaded_, log_err, log_info, dtn::Registration::MAX_RESERVED_REGID, dtn::Globals::next_bundleid_, dtn::Globals::next_regid_, store_, and dtn::Globals::version_.

Referenced by init().

static bool dtn::GlobalStore::initialized (  )  [inline, static]

Return true if initialization has completed.

Definition at line 98 of file GlobalStore.h.

References instance_.

u_int32_t dtn::GlobalStore::next_bundleid (  ) 

Get a new bundle id, updating the value in the store.

(was db_update_bundle_id, db_restore_bundle_id)

Definition at line 170 of file GlobalStore.cc.

References ASSERT, globals_, ExamineDump::l, lock_, log_debug, dtn::Globals::next_bundleid_, and update().

Referenced by dtn::Bundle::Bundle().

u_int32_t dtn::GlobalStore::next_regid (  ) 

Get a new unique registration id, updating the running value in the persistent table.

(was db_new_regID, db_update_registration_id, db_retable_registration_id)

Definition at line 193 of file GlobalStore.cc.

References ASSERT, globals_, ExamineDump::l, lock_, log_debug, dtn::Globals::next_regid_, and update().

Referenced by dtn::APIClient::handle_register().

bool dtn::GlobalStore::load (  ) 

Load in the globals.

Reimplemented in dtn::SQLGlobalStore.

Definition at line 213 of file GlobalStore.cc.

References ASSERT, CURRENT_VERSION, dtn::GLOBAL_KEY, globals_, loaded_, log_crit, log_debug, store_, and dtn::Globals::version_.

void dtn::GlobalStore::close (  ) 

Close (and flush) the data store.

Definition at line 261 of file GlobalStore.cc.

References instance_, oasys::Mutex::lock(), lock_, and store_.

Referenced by dtn::DTNServer::close_datastore().

void dtn::GlobalStore::update (  )  [protected]

Update the globals in the store.

Reimplemented in dtn::SQLGlobalStore.

Definition at line 242 of file GlobalStore.cc.

References ASSERT, oasys::durable_strerror(), dtn::GLOBAL_KEY, globals_, oasys::Lock::is_locked_by_me(), loaded_, lock_, log_debug, and store_.

Referenced by next_bundleid(), and next_regid().


Member Data Documentation

const u_int32_t dtn::GlobalStore::CURRENT_VERSION [static]

Definition at line 65 of file GlobalStore.h.

Referenced by do_init(), and load().

bool dtn::GlobalStore::loaded_ [protected]

Definition at line 137 of file GlobalStore.h.

Referenced by do_init(), load(), and update().

Globals* dtn::GlobalStore::globals_ [protected]

Definition at line 138 of file GlobalStore.h.

Referenced by do_init(), load(), next_bundleid(), next_regid(), update(), and ~GlobalStore().

oasys::SingleTypeDurableTable<Globals>* dtn::GlobalStore::store_ [protected]

Reimplemented in dtn::SQLGlobalStore.

Definition at line 139 of file GlobalStore.h.

Referenced by close(), do_init(), load(), update(), and ~GlobalStore().

oasys::Mutex* dtn::GlobalStore::lock_ [protected]

Definition at line 141 of file GlobalStore.h.

Referenced by close(), GlobalStore(), next_bundleid(), next_regid(), update(), and ~GlobalStore().

GlobalStore * dtn::GlobalStore::instance_ [static, protected]

singleton instance

Definition at line 143 of file GlobalStore.h.

Referenced by close(), init(), initialized(), and instance().


The documentation for this class was generated from the following files:
Generated on Fri Dec 22 14:48:05 2006 for DTN Reference Implementation by  doxygen 1.5.1