IBR-DTNSuite
0.12
|
#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 50 of file SimpleBundleStorage.cpp.
|
virtual |
Destructor
Definition at line 55 of file SimpleBundleStorage.cpp.
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 460 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::begin(), dtn::storage::MetaStorage::end(), ibrcommon::RWMutex::LOCK_READWRITE, and dtn::storage::DataStorage::remove().
|
protectedvirtual |
Implements dtn::daemon::IntegratedComponent.
Definition at line 193 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::clear(), dtn::storage::BundleStorage::clearSpace(), 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 171 of file SimpleBundleStorage.cpp.
References dtn::core::EventDispatcher< E >::add(), ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, info(), dtn::storage::DataStorage::iterateAll(), ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::MetaStorage::size(), ibrcommon::JoinableThread::start(), and ibrcommon::Exception::what().
|
virtual |
This method returns true if the requested bundle is stored in the storage.
Implements dtn::storage::BundleStorage.
Definition at line 389 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::contains(), and ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 244 of file SimpleBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY, and dtn::storage::MetaStorage::size().
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 232 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 94 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::begin(), dtn::storage::MetaStorage::end(), dtn::storage::BundleStorage::freeSpace(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::MetaStorage::remove(), and dtn::storage::DataStorage::Hash::value.
Referenced by eventDataStorageRemoveFailed().
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 115 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 59 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 67 of file SimpleBundleStorage.cpp.
References dtn::data::MetaBundle::create(), ibrcommon::LogLevel::error, dtn::storage::BundleStorage::freeSpace(), 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 285 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::_faulty, dtn::data::AgeBlock::addSeconds(), dtn::data::MetaBundle::create(), ibrcommon::LogLevel::error, dtn::storage::MetaStorage::find(), dtn::data::Bundle::find(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::File::lastaccess(), ibrcommon::File::lastmodify(), ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::DataStorage::retrieve(), and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 261 of file SimpleBundleStorage.cpp.
References dtn::utils::Clock::isExpired(), and ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 352 of file SimpleBundleStorage.cpp.
References dtn::storage::MetaStorage::getDistinctDestinations(), and ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Implements dtn::daemon::Component.
Definition at line 227 of file SimpleBundleStorage.cpp.
|
virtual |
Get meta data about a specific bundle ID
Implements dtn::storage::BundleStorage.
Definition at line 397 of file SimpleBundleStorage.cpp.
References dtn::data::MetaBundle::create(), dtn::storage::MetaStorage::find(), and ibrcommon::RWMutex::LOCK_READONLY.
Referenced by componentUp().
|
virtual |
Implements dtn::storage::DataStorage::Callback.
Definition at line 123 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::allocSpace(), dtn::data::MetaBundle::create(), 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(), store(), 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 215 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 238 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 405 of file SimpleBundleStorage.cpp.
References dtn::data::MetaBundle::create(), dtn::storage::BundleStorage::eventBundleRemoved(), dtn::storage::MetaStorage::find(), dtn::storage::MetaStorage::isRemoved(), ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::MetaStorage::markRemoved(), and dtn::storage::DataStorage::remove().
|
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 255 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 358 of file SimpleBundleStorage.cpp.
References dtn::storage::BundleStorage::acceptCustody(), dtn::storage::BundleStorage::allocSpace(), dtn::data::MetaBundle::create(), dtn::data::PrimaryBlock::custodian, and dtn::data::DefaultSerializer::getLength().
Referenced by iterateDataStorage().
|
virtual |
Wait until all the data has been stored to the disk
Reimplemented from dtn::storage::BundleStorage.
Definition at line 250 of file SimpleBundleStorage.cpp.
References dtn::storage::DataStorage::wait().