#include <InternalKeyDurableTable.h>
Inheritance diagram for oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >:
This interface provides simple hooks for add(), get(), del(), and update() that take only a pointer to the class, not a secondary argument that is the id. The class also implements an alternative iterator interface wherein the iterator stores the current element, rather than forcing the caller to have a local temporary.
To fulfill the contract required by the template, the stored class must implement a function called durable_key() that returns the unique key value, suitable to be passed to the _ShimType constructor.
Finally, to cover the most common (so far) use cases for this class, it implements logging and assertion handlers to cover unexpected cases in the interface, e.g. logging a warning on a call to get() for an id that's not in the table, PANIC on internal database errors, etc.
Definition at line 51 of file InternalKeyDurableTable.h.
Public Member Functions | |
InternalKeyDurableTable (const char *classname, const char *logpath, const char *datatype, const char *table_name) | |
virtual | ~InternalKeyDurableTable () |
int | do_init (const StorageConfig &cfg, DurableStore *store) |
Real initialization method. | |
void | close () |
Close and flush the table. | |
bool | add (_DataType *data) |
_DataType * | get (_KeyType id) |
bool | update (_DataType *data) |
bool | del (_KeyType id) |
iterator * | new_iterator () |
Return a new iterator. | |
Protected Attributes | |
SingleTypeDurableTable< _DataType > * | table_ |
const char * | datatype_ |
const char * | table_name_ |
Classes | |
class | iterator |
STL-style iterator. More... |
oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::InternalKeyDurableTable | ( | const char * | classname, | |
const char * | logpath, | |||
const char * | datatype, | |||
const char * | table_name | |||
) |
virtual oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::~InternalKeyDurableTable | ( | ) | [virtual] |
int oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::do_init | ( | const StorageConfig & | cfg, | |
DurableStore * | store | |||
) |
Real initialization method.
Referenced by dtn::RegistrationStore::init(), and dtn::LinkStore::init().
void oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::close | ( | ) |
Close and flush the table.
Referenced by dtn::BundleStore::close(), and dtn::DTNServer::close_datastore().
bool oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::add | ( | _DataType * | data | ) |
Referenced by dtn::BundleStore::add().
_DataType* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::get | ( | _KeyType | id | ) |
Referenced by dtn::BundleStore::get(), and dtn::BundleDaemon::load_registrations().
bool oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::update | ( | _DataType * | data | ) |
Referenced by dtn::BundleStore::update().
bool oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::del | ( | _KeyType | id | ) |
Referenced by dtn::BundleStore::del().
iterator* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::new_iterator | ( | ) | [inline] |
Return a new iterator.
The caller has the responsibility of deleting it once done.
Definition at line 130 of file InternalKeyDurableTable.h.
References oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::table_.
Referenced by dtn::BundleDaemon::load_registrations(), and dtn::BundleStore::new_iterator().
SingleTypeDurableTable<_DataType>* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::table_ [protected] |
Definition at line 136 of file InternalKeyDurableTable.h.
Referenced by oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::new_iterator().
const char* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::datatype_ [protected] |
Definition at line 137 of file InternalKeyDurableTable.h.
const char* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::table_name_ [protected] |
Definition at line 138 of file InternalKeyDurableTable.h.