dtn::GlobalStore Class Reference

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

#include <GlobalStore.h>

Inheritance diagram for dtn::GlobalStore:
dtn::SQLGlobalStore

List of all members.

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 = 3

Protected Member Functions

void update ()
 Update the globals in the store.
void calc_digest (u_char *digest)
 Calculate a digest of on-disk serialized objects.

Protected Attributes

bool loaded_
Globalsglobals_
oasys::SingleTypeDurableTable
< Globals > * 
store_
oasys::Mutex * lock_

Static Protected Attributes

static GlobalStoreinstance_
 singleton instance

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 42 of file GlobalStore.h.


Constructor & Destructor Documentation

dtn::GlobalStore::GlobalStore (  ) 

Constructor.

Definition at line 71 of file GlobalStore.cc.

References lock_.

Referenced by init().

dtn::GlobalStore::~GlobalStore (  ) 

Destructor.

Definition at line 152 of file GlobalStore.cc.

References globals_, lock_, and store_.


Member Function Documentation

void dtn::GlobalStore::calc_digest ( u_char *  digest  )  [protected]

Calculate a digest of on-disk serialized objects.

Definition at line 197 of file GlobalStore.cc.

Referenced by do_init(), and load().

void dtn::GlobalStore::close (  ) 

Close (and flush) the data store.

Definition at line 289 of file GlobalStore.cc.

References instance_, lock_, and store_.

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

Boot time initializer.

Definition at line 82 of file GlobalStore.cc.

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

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

Return true if initialization has completed.

Definition at line 77 of file GlobalStore.h.

References instance_.

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

Singleton instance accessor.

Definition at line 49 of file GlobalStore.h.

References instance_.

Referenced by dtn::APIClient::handle_register(), dtn::LoggingRegistration::LoggingRegistration(), and dtn::TclRegistration::TclRegistration().

bool dtn::GlobalStore::load (  ) 

Load in the globals.

Reimplemented in dtn::SQLGlobalStore.

Definition at line 227 of file GlobalStore.cc.

References ASSERT, calc_digest(), CURRENT_VERSION, dtn::Globals::digest_, dtn::GLOBAL_KEY, globals_, loaded_, store_, and dtn::Globals::version_.

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 161 of file GlobalStore.cc.

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

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 179 of file GlobalStore.cc.

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

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

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

Update the globals in the store.

Reimplemented in dtn::SQLGlobalStore.

Definition at line 269 of file GlobalStore.cc.

References ASSERT, dtn::GLOBAL_KEY, globals_, loaded_, lock_, and store_.

Referenced by next_bundleid(), and next_regid().


Member Data Documentation

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

Definition at line 44 of file GlobalStore.h.

Referenced by do_init(), and load().

Definition at line 122 of file GlobalStore.h.

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

singleton instance

Definition at line 127 of file GlobalStore.h.

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

Definition at line 121 of file GlobalStore.h.

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

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

Definition at line 125 of file GlobalStore.h.

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

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

Reimplemented in dtn::SQLGlobalStore.

Definition at line 123 of file GlobalStore.h.

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


The documentation for this class was generated from the following files:
Generated on Sun Nov 21 11:41:13 2010 for DTN Reference Implementation by  doxygen 1.6.3