IBR-DTNSuite
0.10
|
#include <SQLiteBundleStorage.h>
Protected Member Functions | |
virtual void | componentRun () throw () |
virtual void | componentUp () throw () |
virtual void | componentDown () throw () |
void | __cancellation () 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 () |
Protected Member Functions inherited from dtn::daemon::IndependentComponent | |
void | run () throw () |
Protected Member Functions inherited from ibrcommon::JoinableThread | |
virtual | ~JoinableThread ()=0 |
void | join (void) throw (ThreadException) |
bool | isRunning (void) |
void | start (int priority=0) throw (ThreadException) |
void | stop () throw () |
JoinableThread (size_t size=DEFAULT_STACKSIZE) | |
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 |
Definition at line 49 of file SQLiteBundleStorage.h.
dtn::storage::SQLiteBundleStorage::SQLiteBundleStorage | ( | const ibrcommon::File & | path, |
const dtn::data::Length & | maxsize | ||
) |
Constructor
Pfad | zum Ordner in denen die Datein gespeichert werden. |
Dateiname | der Datenbank |
maximale | Größe der Datenbank |
Definition at line 115 of file SQLiteBundleStorage.cpp.
References ibrcommon::BLOB::changeProvider(), and ibrcommon::File::get().
|
virtual |
destructor
Definition at line 126 of file SQLiteBundleStorage.cpp.
|
protectedvirtual |
This method is called after componentDown() and should should guarantee that blocking calls in componentRun() will unblock.
Implements dtn::daemon::IndependentComponent.
Definition at line 215 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::abort().
|
virtual |
Clears all bundles and fragments in the storage. Routinginformation won't be deleted.
Reimplemented from dtn::storage::BundleStorage.
Definition at line 473 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::clear(), ibrcommon::File::createDirectory(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, ibrcommon::File::remove(), and ibrcommon::Exception::what().
Referenced by clearAll().
void dtn::storage::SQLiteBundleStorage::clearAll | ( | ) |
Clears the hole database.
Definition at line 468 of file SQLiteBundleStorage.cpp.
References clear().
|
protectedvirtual |
This method is called if the component should stop. Clean-up code should be inserted here.
Implements dtn::daemon::IndependentComponent.
Definition at line 194 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::close(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::JoinableThread::join(), ibrcommon::RWMutex::LOCK_READWRITE, dtn::core::EventDispatcher< E >::remove(), ibrcommon::JoinableThread::stop(), and ibrcommon::Exception::what().
|
protectedvirtual |
This is the run method. The component should loop in there until componentDown() or __cancellation() is called.
Implements dtn::daemon::IndependentComponent.
Definition at line 130 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::getnpop().
|
protectedvirtual |
Is called in preparation of the component. Before componentRun() is called.
Implements dtn::daemon::IndependentComponent.
Definition at line 160 of file SQLiteBundleStorage.cpp.
References dtn::core::EventDispatcher< E >::add(), ibrcommon::File::createDirectory(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::storage::SQLiteDatabase::iterateAll(), ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::SQLiteDatabase::open(), ibrcommon::File::remove(), and ibrcommon::Exception::what().
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 499 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::count(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, and ibrcommon::Exception::what().
|
virtual |
create a new BLOB object within this storage
Implements ibrcommon::BLOB::Provider.
Definition at line 110 of file SQLiteBundleStorage.cpp.
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 488 of file SQLiteBundleStorage.cpp.
References ibrcommon::LogLevel::critical, dtn::storage::SQLiteDatabase::empty(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, and ibrcommon::Exception::what().
|
virtual |
callbacks for the sqlite database
Implements dtn::storage::SQLiteDatabase::DatabaseListener.
Definition at line 606 of file SQLiteBundleStorage.cpp.
|
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 237 of file SQLiteBundleStorage.cpp.
References dtn::data::AgeBlock::addSeconds(), dtn::data::PayloadBlock::BLOCK_TYPE, ibrcommon::BLOB::copy(), ibrcommon::LogLevel::critical, ibrcommon::LogLevel::error, dtn::storage::SQLiteDatabase::get(), ibrcommon::File::getPath(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::BLOB::Reference::iostream(), ibrcommon::File::lastaccess(), ibrcommon::File::lastmodify(), ibrcommon::RWMutex::LOCK_READONLY, dtn::data::Bundle::push_back(), dtn::data::SeparateDeserializer::readBlock(), ibrcommon::BLOB::iostream::size(), and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 231 of file SQLiteBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 220 of file SQLiteBundleStorage.cpp.
References ibrcommon::LogLevel::critical, dtn::storage::SQLiteDatabase::getDistinctDestinations(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::SQLiteDatabase::DatabaseListener.
Definition at line 600 of file SQLiteBundleStorage.cpp.
References dtn::storage::BundleStorage::eventBundleAdded().
|
virtual |
This method is used to receive events.
evt |
Implements dtn::core::EventReceiver.
Definition at line 510 of file SQLiteBundleStorage.cpp.
References dtn::core::TimeEvent::getAction(), dtn::core::GlobalEvent::getAction(), dtn::core::TimeEvent::getTimestamp(), dtn::core::GlobalEvent::GLOBAL_BUSY, dtn::core::GlobalEvent::GLOBAL_IDLE, and dtn::core::TIME_SECOND_TICK.
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 586 of file SQLiteBundleStorage.cpp.
References ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::SQLiteDatabase::update(), dtn::storage::SQLiteDatabase::UPDATE_CUSTODIAN, and ibrcommon::Exception::what().
|
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 445 of file SQLiteBundleStorage.cpp.
References ibrcommon::LogLevel::critical, dtn::storage::BundleStorage::eventBundleRemoved(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::SQLiteDatabase::remove(), and ibrcommon::Exception::what().
|
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 617 of file SQLiteBundleStorage.cpp.
References dtn::storage::BundleStorage::_faulty, and dtn::storage::SQLiteDatabase::setFaulty().
|
virtual |
Stores a bundle in the storage.
bundle | The bundle to store. |
Implements dtn::storage::BundleStorage.
Definition at line 331 of file SQLiteBundleStorage.cpp.
References dtn::storage::BundleStorage::acceptCustody(), dtn::data::Bundle::begin(), dtn::data::PayloadBlock::BLOCK_TYPE, dtn::storage::SQLiteDatabase::commit(), ibrcommon::BLOB::copy(), ibrcommon::LogLevel::critical, dtn::data::Bundle::end(), dtn::storage::BundleStorage::eventBundleAdded(), dtn::data::PayloadBlock::getBLOB(), ibrcommon::File::getPath(), dtn::data::Block::getType(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::BLOB::Reference::iostream(), ibrcommon::RWMutex::LOCK_READWRITE, ibrcommon::File::remove(), dtn::storage::SQLiteDatabase::rollback(), ibrcommon::BLOB::iostream::size(), ibrcommon::File::size(), dtn::storage::SQLiteDatabase::store(), dtn::data::Bundle::toString(), dtn::storage::SQLiteDatabase::transaction(), dtn::storage::SQLiteDatabase::update(), dtn::storage::SQLiteDatabase::UPDATE_CUSTODIAN, and ibrcommon::Exception::what().
|
virtual |
Wait until all the data has been stored to the disk
Reimplemented from dtn::storage::BundleStorage.
Definition at line 612 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::wait().