IBR-DTNSuite
0.10
|
#include <SimpleBundleStorage.h>
Protected Member Functions | |
virtual void | componentUp () throw () |
virtual void | componentDown () throw () |
virtual void | eventBundleExpired (const dtn::data::MetaBundle &b) throw () |
Protected Member Functions inherited from dtn::storage::BundleStorage | |
BundleStorage (const dtn::data::Length &maxsize) | |
void | allocSpace (const dtn::data::Length &size) throw (StorageSizeExeededException) |
void | freeSpace (const dtn::data::Length &size) throw () |
void | clearSpace () throw () |
void | eventBundleAdded (const dtn::data::MetaBundle &b) throw () |
void | eventBundleRemoved (const dtn::data::BundleID &id) throw () |
Additional Inherited Members | |
Public Types inherited from dtn::storage::BundleSeeker | |
typedef std::set< dtn::data::EID > | eid_set |
Protected Attributes inherited from dtn::storage::BundleStorage | |
bool | _faulty |
This storage holds all bundles and fragments in the system memory.
Definition at line 53 of file SimpleBundleStorage.h.
dtn::storage::SimpleBundleStorage::SimpleBundleStorage | ( | const ibrcommon::File & | workdir, |
const dtn::data::Length | maxsize = 0 , |
||
const unsigned int | buffer_limit = 0 |
||
) |
Constructor
Definition at line 49 of file SimpleBundleStorage.cpp.
|
virtual |
Destructor
Definition at line 54 of file SimpleBundleStorage.cpp.
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 458 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::begin(), dtn::storage::MetaStorage::clear(), dtn::storage::MetaStorage::end(), ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
|
protectedvirtual |
Implements dtn::daemon::IntegratedComponent.
Definition at line 185 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::clear(), ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::JoinableThread::join(), ibrcommon::RWMutex::LOCK_READWRITE, dtn::core::EventDispatcher< E >::remove(), dtn::storage::DataStorage::reset(), ibrcommon::JoinableThread::stop(), dtn::storage::DataStorage::wait(), and ibrcommon::Exception::what().
|
protectedvirtual |
Implements dtn::daemon::IntegratedComponent.
Definition at line 163 of file SimpleBundleStorage.cpp.
References dtn::core::EventDispatcher< E >::add(), ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, dtn::storage::DataStorage::iterateAll(), ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::MetaStorage::size(), ibrcommon::JoinableThread::start(), and ibrcommon::Exception::what().
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 235 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY, and dtn::storage::MetaStorage::size().
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 223 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::empty(), and ibrcommon::RWMutex::LOCK_READONLY.
|
protectedvirtual |
Implements dtn::data::BundleList::Listener.
Definition at line 477 of file SimpleBundleStorage.cpp.
References dtn::core::BUNDLE_DELETED, dtn::data::StatusReportBlock::LIFETIME_EXPIRED, dtn::core::BundleExpiredEvent::raise(), and dtn::core::BundleEvent::raise().
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 96 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::begin(), dtn::storage::MetaStorage::end(), dtn::storage::BundleStorage::freeSpace(), dtn::storage::MetaStorage::getSize(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::MetaStorage::remove(), dtn::data::BundleID::toString(), and dtn::storage::DataStorage::Hash::value.
Referenced by eventDataStorageRemoveFailed().
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 120 of file SimpleBundleStorage.cpp.
References ibrcommon::LogLevel::error, eventDataStorageRemoved(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::storage::DataStorage::Hash::value, and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 58 of file SimpleBundleStorage.cpp.
References IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READWRITE, and dtn::storage::DataStorage::Hash::value.
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 66 of file SimpleBundleStorage.cpp.
References ibrcommon::LogLevel::error, dtn::storage::BundleStorage::freeSpace(), dtn::storage::MetaStorage::getSize(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::MetaStorage::remove(), dtn::storage::DataStorage::Hash::value, and ibrcommon::Exception::what().
|
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 276 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::_faulty, dtn::data::AgeBlock::addSeconds(), ibrcommon::LogLevel::error, dtn::data::Bundle::find(), dtn::storage::MetaStorage::find(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::File::lastaccess(), ibrcommon::File::lastmodify(), ibrcommon::RWMutex::LOCK_READONLY, dtn::data::MetaBundle::mockUp(), dtn::storage::DataStorage::retrieve(), dtn::data::BundleID::toString(), and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 252 of file SimpleBundleStorage.cpp.
References dtn::utils::Clock::isExpired(), dtn::data::MetaBundle::lifetime, ibrcommon::RWMutex::LOCK_READONLY, and dtn::data::BundleID::timestamp.
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 343 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::getDistinctDestinations(), and ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Implements dtn::daemon::Component.
Definition at line 218 of file SimpleBundleStorage.cpp.
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 128 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::allocSpace(), ibrcommon::LogLevel::error, dtn::storage::BundleStorage::eventBundleAdded(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::DataStorage::remove(), dtn::storage::MetaStorage::store(), and dtn::storage::DataStorage::Hash::value.
|
virtual |
This method is used to receive events.
evt |
Implements dtn::core::EventReceiver.
Definition at line 206 of file SimpleBundleStorage.cpp.
References dtn::core::TimeEvent::getAction(), dtn::core::TimeEvent::getTimestamp(), ibrcommon::RWMutex::LOCK_READWRITE, and dtn::core::TIME_SECOND_TICK.
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 229 of file SimpleBundleStorage.cpp.
|
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 379 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::eventBundleRemoved(), dtn::storage::MetaStorage::find(), dtn::storage::MetaStorage::isRemoved(), ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::MetaStorage::markRemoved(), dtn::data::MetaBundle::mockUp(), dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
|
virtual |
Remove one bundles which match this filter
filter |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 434 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::eventBundleRemoved(), dtn::storage::MetaStorage::find(), dtn::storage::MetaStorage::isRemoved(), ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::MetaStorage::markRemoved(), dtn::storage::DataStorage::remove(), and dtn::data::BundleID::toString().
|
virtual |
Set the storage to faulty. If set to true, each try to store or retrieve a bundle will fail.
Reimplemented from dtn::storage::BundleStorage.
Definition at line 246 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::_faulty, and dtn::storage::DataStorage::setFaulty().
|
virtual |
Stores a bundle in the storage.
bundle | The bundle to store. |
Implements dtn::storage::BundleStorage.
Definition at line 349 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::acceptCustody(), dtn::storage::BundleStorage::allocSpace(), dtn::data::PrimaryBlock::custodian, and dtn::data::DefaultSerializer::getLength().
|
virtual |
Wait until all the data has been stored to the disk
Reimplemented from dtn::storage::BundleStorage.
Definition at line 241 of file SimpleBundleStorage.cpp.
References dtn::storage::DataStorage::wait().