IBR-DTNSuite
0.12
|
#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 50 of file SQLiteBundleStorage.h.
dtn::storage::SQLiteBundleStorage::SQLiteBundleStorage | ( | const ibrcommon::File & | path, |
const dtn::data::Length & | maxsize, | ||
bool | usePersistentBundleSets = false |
||
) |
Constructor
Pfad | zum Ordner in denen die Datein gespeichert werden. |
Dateiname | der Datenbank |
maximale | Größe der Datenbank |
should | bundleSets be stored persistently in database? standard: false |
Definition at line 115 of file SQLiteBundleStorage.cpp.
References ibrcommon::BLOB::changeProvider(), ibrcommon::File::createDirectory(), ibrcommon::LogLevel::critical, ibrcommon::File::get(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::SQLiteDatabase::open(), ibrcommon::File::remove(), dtn::data::BundleSet::setFactory(), and ibrcommon::Exception::what().
|
virtual |
destructor
Definition at line 148 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::close(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, dtn::data::BundleSet::setFactory(), and ibrcommon::Exception::what().
|
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 221 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 503 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::clear(), dtn::storage::BundleStorage::clearSpace(), ibrcommon::File::createDirectory(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, ibrcommon::File::remove(), and ibrcommon::Exception::what().
|
protectedvirtual |
This method is called if the component should stop. Clean-up code should be inserted here.
Implements dtn::daemon::IndependentComponent.
Definition at line 209 of file SQLiteBundleStorage.cpp.
References ibrcommon::JoinableThread::join(), dtn::core::EventDispatcher< E >::remove(), and ibrcommon::JoinableThread::stop().
|
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 163 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 193 of file SQLiteBundleStorage.cpp.
References dtn::core::EventDispatcher< E >::add(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::storage::SQLiteDatabase::iterateAll(), 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 467 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::contains(), and ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 532 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 521 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 642 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 243 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 237 of file SQLiteBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Implements dtn::storage::BundleStorage.
Definition at line 226 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 |
Get meta data about a specific bundle ID
Implements dtn::storage::BundleStorage.
Definition at line 477 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::get(), and ibrcommon::RWMutex::LOCK_READONLY.
|
virtual |
Implements dtn::storage::SQLiteDatabase::DatabaseListener.
Definition at line 633 of file SQLiteBundleStorage.cpp.
References dtn::storage::BundleStorage::allocSpace(), and dtn::storage::BundleStorage::eventBundleAdded().
|
virtual |
This method is used to receive events.
evt |
Implements dtn::core::EventReceiver.
Definition at line 543 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 619 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 489 of file SQLiteBundleStorage.cpp.
References ibrcommon::LogLevel::critical, dtn::storage::BundleStorage::eventBundleRemoved(), dtn::storage::BundleStorage::freeSpace(), 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 656 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 342 of file SQLiteBundleStorage.cpp.
References dtn::storage::BundleStorage::acceptCustody(), dtn::storage::BundleStorage::allocSpace(), dtn::data::Bundle::begin(), dtn::data::PayloadBlock::BLOCK_TYPE, dtn::storage::SQLiteDatabase::commit(), ibrcommon::BLOB::copy(), dtn::data::MetaBundle::create(), ibrcommon::LogLevel::critical, dtn::data::Bundle::end(), dtn::storage::BundleStorage::eventBundleAdded(), dtn::storage::BundleStorage::freeSpace(), dtn::data::PayloadBlock::getBLOB(), dtn::data::DefaultSerializer::getLength(), 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(), dtn::storage::BundleStorage::size(), ibrcommon::File::size(), dtn::storage::SQLiteDatabase::store(), dtn::data::BundleID::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 651 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::wait().