#include <SimpleBundleStorage.h>

Public Member Functions | |
| SimpleBundleStorage (unsigned int size=1024 *1024, unsigned int bundle_maxsize=1024) | |
| virtual | ~SimpleBundleStorage () |
| void | store (const BundleSchedule &schedule) |
| Bundle * | storeFragment (const Bundle &bundle) |
| BundleSchedule | getSchedule (unsigned int dtntime) |
| BundleSchedule | getSchedule (string destination) |
| void | clear () |
| bool | isEmpty () |
| unsigned int | getCount () |
Protected Member Functions | |
| virtual void | tick () |
| void | terminate () |
| void | eventNodeAvailable (const Node &node) |
| void | eventNodeUnavailable (const Node &node) |
Private Member Functions | |
| void | deleteDeprecated () |
Private Attributes | |
| list< BundleSchedule > | m_schedules |
| list< list< Bundle > > | m_fragments |
| unsigned int | m_nextdeprecation |
| time_t | m_last_compress |
| unsigned int | m_size |
| unsigned int | m_bundle_maxsize |
| unsigned int | m_currentsize |
| bool | m_nocleanup |
| Mutex | m_readlock |
| Mutex | m_fragmentslock |
| map< string, Node > | m_neighbours |
| dtn::core::SimpleBundleStorage::SimpleBundleStorage | ( | unsigned int | size = 1024 * 1024, |
|
| unsigned int | bundle_maxsize = 1024 | |||
| ) |
Constructor
| [in] | size | Size of the memory storage in kBytes. (e.g. 1024*1024 = 1MB) |
| [in] | bundle_maxsize | Maximum size of one bundle in bytes. |
| dtn::core::SimpleBundleStorage::~SimpleBundleStorage | ( | ) | [virtual] |
Destructor
References clear().
| void dtn::core::SimpleBundleStorage::store | ( | const BundleSchedule & | schedule | ) | [virtual] |
Implements dtn::core::AbstractBundleStorage.
References dtn::data::CREATION_TIMESTAMP, dtn::core::BundleSchedule::getBundle(), dtn::data::Bundle::getInteger(), dtn::data::Bundle::getLength(), dtn::core::BundleSchedule::getTime(), dtn::data::LIFETIME, m_currentsize, m_nextdeprecation, m_nocleanup, m_readlock, m_schedules, and m_size.
Implements dtn::core::AbstractBundleStorage.
References dtn::core::CUSTODY_ACCEPT, dtn::data::FRAGMENTATION_OFFSET, dtn::data::Bundle::getCustodian(), dtn::core::BundleCore::getInstance(), dtn::data::Bundle::getInteger(), dtn::core::BundleCore::getLocalURI(), dtn::data::Bundle::getPrimaryFlags(), dtn::data::PrimaryFlags::isCustodyRequested(), m_fragments, m_fragmentslock, dtn::core::EventSwitch::raiseEvent(), and dtn::data::Bundle::setCustodian().
| BundleSchedule dtn::core::SimpleBundleStorage::getSchedule | ( | unsigned int | dtntime | ) |
References dtn::core::BundleSchedule::getBundle(), dtn::data::Bundle::getLength(), dtn::core::BundleSchedule::getTime(), isEmpty(), m_currentsize, m_readlock, and m_schedules.
Referenced by tick().
| BundleSchedule dtn::core::SimpleBundleStorage::getSchedule | ( | string | destination | ) |
| void dtn::core::SimpleBundleStorage::clear | ( | ) | [virtual] |
Reimplemented from dtn::core::AbstractBundleStorage.
References m_currentsize, m_fragments, m_readlock, and m_schedules.
Referenced by ~SimpleBundleStorage().
| bool dtn::core::SimpleBundleStorage::isEmpty | ( | ) | [virtual] |
Reimplemented from dtn::core::AbstractBundleStorage.
References m_readlock, and m_schedules.
Referenced by getSchedule().
| unsigned int dtn::core::SimpleBundleStorage::getCount | ( | ) | [virtual] |
Reimplemented from dtn::core::AbstractBundleStorage.
References m_readlock, and m_schedules.
| void dtn::core::SimpleBundleStorage::tick | ( | ) | [protected, virtual] |
Implements dtn::utils::Service.
References dtn::core::BundleSchedule::getBundle(), getSchedule(), dtn::core::Node::getURI(), m_neighbours, dtn::core::EventSwitch::raiseEvent(), dtn::core::ROUTE_PROCESS_BUNDLE, and dtn::core::AbstractBundleStorage::wait().
| void dtn::core::SimpleBundleStorage::terminate | ( | ) | [protected, virtual] |
| void dtn::core::SimpleBundleStorage::eventNodeAvailable | ( | const Node & | node | ) | [protected, virtual] |
Reimplemented from dtn::core::AbstractBundleStorage.
References dtn::core::Node::getURI(), and m_neighbours.
| void dtn::core::SimpleBundleStorage::eventNodeUnavailable | ( | const Node & | node | ) | [protected, virtual] |
Reimplemented from dtn::core::AbstractBundleStorage.
References dtn::core::Node::getURI(), and m_neighbours.
| void dtn::core::SimpleBundleStorage::deleteDeprecated | ( | ) | [private] |
Try to find outdated bundles and delete them. Additional a deleted report is created if necessary.
References dtn::core::BUNDLE_DELETED, dtn::data::CREATION_TIMESTAMP, dtn::data::Bundle::getInteger(), dtn::data::Bundle::getLength(), dtn::data::Bundle::isExpired(), dtn::data::LIFETIME, dtn::data::LIFETIME_EXPIRED, m_currentsize, m_nextdeprecation, m_readlock, m_schedules, and dtn::core::EventSwitch::raiseEvent().
list<BundleSchedule> dtn::core::SimpleBundleStorage::m_schedules [private] |
Referenced by clear(), deleteDeprecated(), getCount(), getSchedule(), isEmpty(), and store().
list<list<Bundle> > dtn::core::SimpleBundleStorage::m_fragments [private] |
Referenced by clear(), and storeFragment().
unsigned int dtn::core::SimpleBundleStorage::m_nextdeprecation [private] |
A variable to hold the next timeout of a bundle in the storage.
Referenced by deleteDeprecated(), and store().
time_t dtn::core::SimpleBundleStorage::m_last_compress [private] |
unsigned int dtn::core::SimpleBundleStorage::m_size [private] |
Referenced by store().
unsigned int dtn::core::SimpleBundleStorage::m_bundle_maxsize [private] |
unsigned int dtn::core::SimpleBundleStorage::m_currentsize [private] |
Referenced by clear(), deleteDeprecated(), getSchedule(), and store().
bool dtn::core::SimpleBundleStorage::m_nocleanup [private] |
Referenced by store().
Referenced by clear(), deleteDeprecated(), getCount(), getSchedule(), isEmpty(), and store().
Referenced by storeFragment().
map<string,Node> dtn::core::SimpleBundleStorage::m_neighbours [private] |
Referenced by eventNodeAvailable(), eventNodeUnavailable(), and tick().
1.5.6