IBR-DTNSuite
0.8
|
#include <SimpleBundleStorage.h>
This storage holds all bundles and fragments in the system memory.
Definition at line 33 of file SimpleBundleStorage.h.
dtn::storage::SimpleBundleStorage::SimpleBundleStorage | ( | const ibrcommon::File & | workdir, |
size_t | maxsize = 0 , |
||
size_t | buffer_limit = 0 |
||
) |
Constructor
Definition at line 23 of file SimpleBundleStorage.cpp.
References dtn::data::BundleList::_bundles, IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and dtn::storage::DataStorage::iterateAll().
dtn::storage::SimpleBundleStorage::~SimpleBundleStorage | ( | ) | [virtual] |
Destructor
Definition at line 33 of file SimpleBundleStorage.cpp.
void dtn::storage::SimpleBundleStorage::clear | ( | ) | [virtual] |
Reimplemented from dtn::data::BundleList.
Definition at line 378 of file SimpleBundleStorage.cpp.
References dtn::data::BundleList::_bundles, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
void dtn::storage::SimpleBundleStorage::componentDown | ( | ) | [protected, virtual] |
Implements dtn::daemon::IntegratedComponent.
Definition at line 168 of file SimpleBundleStorage.cpp.
References dtn::core::TimeEvent::className, ibrcommon::JoinableThread::join(), ibrcommon::JoinableThread::stop(), and dtn::core::EventReceiver::unbindEvent().
void dtn::storage::SimpleBundleStorage::componentUp | ( | ) | [protected, virtual] |
Implements dtn::daemon::IntegratedComponent.
Definition at line 162 of file SimpleBundleStorage.cpp.
References dtn::core::EventReceiver::bindEvent(), dtn::core::TimeEvent::className, and ibrcommon::JoinableThread::start().
unsigned int dtn::storage::SimpleBundleStorage::count | ( | ) | [virtual] |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 204 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY, and size().
bool dtn::storage::SimpleBundleStorage::empty | ( | ) | [virtual] |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 192 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY.
void dtn::storage::SimpleBundleStorage::eventBundleExpired | ( | const ExpiringBundle & | b | ) | [protected, virtual] |
Reimplemented from dtn::data::BundleList.
Definition at line 402 of file SimpleBundleStorage.cpp.
References dtn::data::BundleList::ExpiringBundle::bundle, dtn::core::BUNDLE_DELETED, dtn::data::StatusReportBlock::LIFETIME_EXPIRED, dtn::core::BundleExpiredEvent::raise(), dtn::core::BundleEvent::raise(), dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
void dtn::storage::SimpleBundleStorage::eventDataStorageRemoved | ( | const dtn::storage::DataStorage::Hash & | hash | ) | [virtual] |
Implements dtn::storage::DataStorage::Callback.
Definition at line 64 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READWRITE.
void dtn::storage::SimpleBundleStorage::eventDataStorageRemoveFailed | ( | const dtn::storage::DataStorage::Hash & | hash, |
const ibrcommon::Exception & | ex | ||
) | [virtual] |
Implements dtn::storage::DataStorage::Callback.
Definition at line 84 of file SimpleBundleStorage.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and ibrcommon::Exception::what().
void dtn::storage::SimpleBundleStorage::eventDataStorageStored | ( | const dtn::storage::DataStorage::Hash & | hash | ) | [virtual] |
Implements dtn::storage::DataStorage::Callback.
Definition at line 37 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READWRITE.
void dtn::storage::SimpleBundleStorage::eventDataStorageStoreFailed | ( | const dtn::storage::DataStorage::Hash & | hash, |
const ibrcommon::Exception & | ex | ||
) | [virtual] |
Implements dtn::storage::DataStorage::Callback.
Definition at line 45 of file SimpleBundleStorage.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READWRITE, and ibrcommon::Exception::what().
dtn::data::Bundle dtn::storage::SimpleBundleStorage::get | ( | const dtn::data::BundleID & | id | ) | [virtual] |
This method returns a specific bundle which is identified by its id.
id | The ID of the bundle to return. |
Implements dtn::storage::BundleStorage.
Definition at line 231 of file SimpleBundleStorage.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READONLY, and ibrcommon::Exception::what().
const std::list< dtn::data::MetaBundle > dtn::storage::SimpleBundleStorage::get | ( | BundleFilterCallback & | cb | ) | [virtual] |
Implements dtn::storage::BundleStorage.
Definition at line 210 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::BundleFilterCallback::limit(), ibrcommon::RWMutex::LOCK_READONLY, and dtn::storage::BundleStorage::BundleFilterCallback::shouldAdd().
const std::set< dtn::data::EID > dtn::storage::SimpleBundleStorage::getDistinctDestinations | ( | ) | [virtual] |
Implements dtn::storage::BundleStorage.
Definition at line 257 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY.
const std::string dtn::storage::SimpleBundleStorage::getName | ( | ) | const [virtual] |
Implements dtn::daemon::Component.
Definition at line 187 of file SimpleBundleStorage.cpp.
void dtn::storage::SimpleBundleStorage::iterateDataStorage | ( | const dtn::storage::DataStorage::Hash & | hash, |
dtn::storage::DataStorage::istream & | stream | ||
) | [virtual] |
Implements dtn::storage::DataStorage::Callback.
Definition at line 89 of file SimpleBundleStorage.cpp.
References dtn::data::BundleList::add(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::DataStorage::remove(), and dtn::storage::DataStorage::Hash::value.
void dtn::storage::SimpleBundleStorage::raiseEvent | ( | const dtn::core::Event * | evt | ) | [virtual] |
This method is used to receive events.
evt |
Implements dtn::core::EventReceiver.
Definition at line 175 of file SimpleBundleStorage.cpp.
References dtn::data::BundleList::expire(), dtn::core::TimeEvent::getAction(), dtn::core::TimeEvent::getTimestamp(), ibrcommon::RWMutex::LOCK_READWRITE, and dtn::core::TIME_SECOND_TICK.
void dtn::storage::SimpleBundleStorage::releaseCustody | ( | const dtn::data::EID & | custodian, |
const dtn::data::BundleID & | id | ||
) | [virtual] |
Implements dtn::storage::BundleStorage.
Definition at line 198 of file SimpleBundleStorage.cpp.
void dtn::storage::SimpleBundleStorage::remove | ( | const dtn::data::BundleID & | id | ) | [virtual] |
This method deletes a specific bundle in the storage. No reports will be generated here.
id | The ID of the bundle to remove. |
Implements dtn::storage::BundleStorage.
Definition at line 319 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
Referenced by remove().
dtn::data::MetaBundle dtn::storage::SimpleBundleStorage::remove | ( | const ibrcommon::BloomFilter & | filter | ) | [virtual] |
Remove one bundles which match this filter
filter |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 346 of file SimpleBundleStorage.cpp.
References ibrcommon::BloomFilter::contains(), ibrcommon::RWMutex::LOCK_READWRITE, remove(), dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
size_t dtn::storage::SimpleBundleStorage::size | ( | ) | const |
void dtn::storage::SimpleBundleStorage::store | ( | const dtn::data::Bundle & | bundle | ) | [virtual] |
Stores a bundle in the storage.
bundle | The bundle to store. |
Implements dtn::storage::BundleStorage.
Definition at line 264 of file SimpleBundleStorage.cpp.
References dtn::data::PrimaryBlock::_custodian, dtn::storage::BundleStorage::acceptCustody(), dtn::data::BundleList::add(), dtn::data::DefaultSerializer::getLength(), ibrcommon::RWMutex::LOCK_READWRITE, and dtn::storage::DataStorage::store().