#include <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 GlobalStore * | instance () |
| 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_ |
| Globals * | globals_ |
| oasys::SingleTypeDurableTable < Globals > * | store_ |
| oasys::Mutex * | lock_ |
Static Protected Attributes | |
| static GlobalStore * | instance_ |
| singleton instance | |
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.
| dtn::GlobalStore::GlobalStore | ( | ) |
| dtn::GlobalStore::~GlobalStore | ( | ) |
| void dtn::GlobalStore::calc_digest | ( | u_char * | digest | ) | [protected] |
| void dtn::GlobalStore::close | ( | ) |
Close (and flush) the data store.
Definition at line 289 of file GlobalStore.cc.
References instance_, lock_, and store_.
Referenced by dtn::DTNServer::close_datastore().
| int dtn::GlobalStore::do_init | ( | const oasys::StorageConfig & | cfg, | |
| oasys::DurableStore * | store | |||
| ) |
Real initialization method.
Definition at line 96 of file GlobalStore.cc.
References calc_digest(), CURRENT_VERSION, dtn::Globals::digest_, dtn::GLOBAL_KEY, dtn::GLOBAL_TABLE, globals_, loaded_, log_err_p, dtn::Registration::MAX_RESERVED_REGID, dtn::Globals::next_bundleid_, dtn::Globals::next_regid_, store_, and dtn::Globals::version_.
Referenced by init().
| 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_.
Referenced by dtn::DTNServer::init_datastore().
| 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::Bundle::Bundle(), dtn::DTNServer::close_datastore(), dtn::APIClient::handle_register(), and dtn::DTNServer::init_datastore().
| 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().
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 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().
const u_int32_t dtn::GlobalStore::CURRENT_VERSION = 3 [static] |
Globals* dtn::GlobalStore::globals_ [protected] |
Definition at line 122 of file GlobalStore.h.
Referenced by do_init(), load(), next_bundleid(), next_regid(), update(), and ~GlobalStore().
GlobalStore * dtn::GlobalStore::instance_ [static, protected] |
singleton instance
Definition at line 127 of file GlobalStore.h.
Referenced by close(), init(), initialized(), and instance().
bool dtn::GlobalStore::loaded_ [protected] |
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().
1.5.8