IBR-DTNSuite
0.8
|
#include <SQLiteBundleStorage.h>
Classes | |
class | BlockingTask |
class | SQLiteBLOB |
class | Task |
class | TaskExpire |
class | TaskIdle |
class | TaskRemove |
Public Member Functions | |
ibrcommon::BLOB::Reference | create () |
SQLiteBundleStorage (const ibrcommon::File &path, const size_t &size) | |
virtual | ~SQLiteBundleStorage () |
void | store (const dtn::data::Bundle &bundle) |
dtn::data::Bundle | get (const dtn::data::BundleID &id) |
const std::list < dtn::data::MetaBundle > | get (BundleFilterCallback &cb) |
virtual const std::set < dtn::data::EID > | getDistinctDestinations () |
void | remove (const dtn::data::BundleID &id) |
void | clear () |
void | clearAll () |
bool | empty () |
unsigned int | count () |
void | releaseCustody (const dtn::data::EID &custodian, const dtn::data::BundleID &id) |
void | raiseEvent (const dtn::core::Event *evt) |
Protected Member Functions | |
virtual void | componentRun () |
virtual void | componentUp () |
virtual void | componentDown () |
void | __cancellation () |
Definition at line 34 of file SQLiteBundleStorage.h.
dtn::storage::SQLiteBundleStorage::SQLiteBundleStorage | ( | const ibrcommon::File & | path, |
const size_t & | size | ||
) |
Constructor
Pfad | zum Ordner in denen die Datein gespeichert werden. |
Dateiname | der Datenbank |
maximale | Größe der Datenbank |
Definition at line 104 of file SQLiteBundleStorage.cpp.
References ibrcommon::File::get().
dtn::storage::SQLiteBundleStorage::~SQLiteBundleStorage | ( | ) | [virtual] |
destructor
Definition at line 112 of file SQLiteBundleStorage.cpp.
References ibrcommon::JoinableThread::join(), and ibrcommon::JoinableThread::stop().
void dtn::storage::SQLiteBundleStorage::__cancellation | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 181 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::abort().
void dtn::storage::SQLiteBundleStorage::clear | ( | ) | [virtual] |
Clears all bundles and fragments in the storage. Routinginformation won't be deleted.
Reimplemented from dtn::storage::BundleStorage.
Definition at line 368 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::clear(), ibrcommon::File::createDirectory(), ibrcommon::RWMutex::LOCK_READWRITE, and ibrcommon::File::remove().
Referenced by clearAll().
Clears the hole database.
Definition at line 363 of file SQLiteBundleStorage.cpp.
References clear().
void dtn::storage::SQLiteBundleStorage::componentDown | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 169 of file SQLiteBundleStorage.cpp.
References dtn::core::TimeEvent::className, dtn::core::GlobalEvent::className, dtn::storage::SQLiteDatabase::close(), ibrcommon::RWMutex::LOCK_READWRITE, and dtn::core::EventReceiver::unbindEvent().
void dtn::storage::SQLiteBundleStorage::componentRun | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 118 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::getnpop().
void dtn::storage::SQLiteBundleStorage::componentUp | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 148 of file SQLiteBundleStorage.cpp.
References dtn::core::EventReceiver::bindEvent(), dtn::core::TimeEvent::className, dtn::core::GlobalEvent::className, ibrcommon::File::createDirectory(), ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::SQLiteDatabase::open(), and ibrcommon::File::remove().
unsigned int dtn::storage::SQLiteBundleStorage::count | ( | ) | [virtual] |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 385 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::count(), and ibrcommon::RWMutex::LOCK_READONLY.
create a new BLOB object within this storage
Implements ibrcommon::BLOB::Provider.
Definition at line 99 of file SQLiteBundleStorage.cpp.
bool dtn::storage::SQLiteBundleStorage::empty | ( | ) | [virtual] |
Reimplemented from dtn::storage::BundleStorage.
Definition at line 379 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::empty(), and ibrcommon::RWMutex::LOCK_READONLY.
dtn::data::Bundle dtn::storage::SQLiteBundleStorage::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 198 of file SQLiteBundleStorage.cpp.
References dtn::data::AgeBlock::addSeconds(), dtn::data::PrimaryBlock::APPDATA_IS_ADMRECORD, dtn::data::PayloadBlock::BLOCK_TYPE, dtn::data::PrimaryBlock::get(), dtn::storage::SQLiteDatabase::get(), ibrcommon::File::getPath(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::File::lastaccess(), ibrcommon::File::lastmodify(), ibrcommon::RWMutex::LOCK_READONLY, dtn::data::Bundle::push_back(), and dtn::data::SeparateDeserializer::readBlock().
const std::list< dtn::data::MetaBundle > dtn::storage::SQLiteBundleStorage::get | ( | BundleFilterCallback & | cb | ) | [virtual] |
Implements dtn::storage::BundleStorage.
Definition at line 192 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::get(), and ibrcommon::RWMutex::LOCK_READONLY.
const std::set< dtn::data::EID > dtn::storage::SQLiteBundleStorage::getDistinctDestinations | ( | ) | [virtual] |
Implements dtn::storage::BundleStorage.
Definition at line 186 of file SQLiteBundleStorage.cpp.
References dtn::storage::SQLiteDatabase::getDistinctDestinations(), and ibrcommon::RWMutex::LOCK_READONLY.
void dtn::storage::SQLiteBundleStorage::raiseEvent | ( | const dtn::core::Event * | evt | ) | [virtual] |
This method is used to receive events.
evt |
Implements dtn::core::EventReceiver.
Definition at line 391 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, ibrcommon::Queue< T >::push(), and dtn::core::TIME_SECOND_TICK.
void dtn::storage::SQLiteBundleStorage::releaseCustody | ( | const dtn::data::EID & | custodian, |
const dtn::data::BundleID & | id | ||
) | [virtual] |
Implements dtn::storage::BundleStorage.
Definition at line 461 of file SQLiteBundleStorage.cpp.
References ibrcommon::RWMutex::LOCK_READONLY, dtn::storage::SQLiteDatabase::update(), and dtn::storage::SQLiteDatabase::UPDATE_CUSTODIAN.
void dtn::storage::SQLiteBundleStorage::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 352 of file SQLiteBundleStorage.cpp.
References ibrcommon::Queue< T >::push().
void dtn::storage::SQLiteBundleStorage::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 266 of file SQLiteBundleStorage.cpp.
References dtn::storage::BundleStorage::acceptCustody(), dtn::storage::SQLiteDatabase::commit(), dtn::data::PayloadBlock::getBLOB(), dtn::data::Bundle::getBlocks(), dtn::data::Block::getLength(), ibrcommon::File::getPath(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::BLOB::Reference::iostream(), ibrcommon::RWMutex::LOCK_READWRITE, ibrcommon::File::remove(), dtn::storage::SQLiteDatabase::rollback(), ibrcommon::File::size(), dtn::storage::SQLiteDatabase::store(), dtn::data::Bundle::toString(), dtn::storage::SQLiteDatabase::transaction(), dtn::storage::SQLiteDatabase::update(), and dtn::storage::SQLiteDatabase::UPDATE_CUSTODIAN.