IBR-DTNSuite
0.10
|
#include <SQLiteDatabase.h>
Classes | |
class | DatabaseListener |
class | SQLBundleQuery |
class | SQLiteQueryException |
class | Statement |
Public Types | |
enum | UPDATE_VALUES { UPDATE_CUSTODIAN } |
typedef std::list< std::pair < int, const ibrcommon::File > > | blocklist |
typedef std::pair< int, const ibrcommon::File > | blocklist_entry |
![]() | |
typedef std::set< dtn::data::EID > | eid_set |
Public Member Functions | |
SQLiteDatabase (const ibrcommon::File &file, DatabaseListener &listener) | |
virtual | ~SQLiteDatabase () |
void | open () throw (SQLiteQueryException) |
void | close () |
void | expire (const dtn::data::Timestamp ×tamp) throw () |
void | vacuum () throw (SQLiteQueryException) |
void | update (UPDATE_VALUES, const dtn::data::BundleID &id, const dtn::data::EID &) throw (SQLiteQueryException) |
void | remove (const dtn::data::BundleID &id) throw (SQLiteQueryException) |
virtual void | get (const BundleSelector &cb, BundleResult &result) throw (NoBundleFoundException, BundleSelectorException, BundleSelectorException) |
void | get (const dtn::data::BundleID &id, dtn::data::MetaBundle &meta) const throw (SQLiteQueryException, NoBundleFoundException) |
void | get (const dtn::data::BundleID &id, dtn::data::Bundle &bundle, blocklist &blocks) const throw (SQLiteQueryException, NoBundleFoundException) |
void | store (const dtn::data::Bundle &bundle) throw (SQLiteQueryException) |
void | store (const dtn::data::BundleID &id, int index, const dtn::data::Block &block, const ibrcommon::File &file) throw (SQLiteQueryException) |
void | transaction () throw (SQLiteQueryException) |
void | rollback () throw (SQLiteQueryException) |
void | commit () throw (SQLiteQueryException) |
bool | empty () const throw (SQLiteQueryException) |
dtn::data::Size | count () const throw (SQLiteQueryException) |
void | clear () throw (SQLiteQueryException) |
virtual const eid_set | getDistinctDestinations () throw (SQLiteQueryException) |
void | iterateAll () throw (SQLiteQueryException) |
void | setFaulty (bool mode) |
![]() | |
virtual | ~BundleSeeker () |
Definition at line 40 of file SQLiteDatabase.h.
typedef std::list<std::pair<int, const ibrcommon::File> > dtn::storage::SQLiteDatabase::blocklist |
Definition at line 165 of file SQLiteDatabase.h.
typedef std::pair<int, const ibrcommon::File> dtn::storage::SQLiteDatabase::blocklist_entry |
Definition at line 166 of file SQLiteDatabase.h.
Enumerator | |
---|---|
UPDATE_CUSTODIAN |
Definition at line 103 of file SQLiteDatabase.h.
dtn::storage::SQLiteDatabase::SQLiteDatabase | ( | const ibrcommon::File & | file, |
DatabaseListener & | listener | ||
) |
Definition at line 175 of file SQLiteDatabase.cpp.
|
virtual |
Definition at line 180 of file SQLiteDatabase.cpp.
void dtn::storage::SQLiteDatabase::clear | ( | ) | throw (SQLiteQueryException) |
Definition at line 773 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step(), and vacuum().
Referenced by dtn::storage::SQLiteBundleStorage::clear().
void dtn::storage::SQLiteDatabase::close | ( | ) |
close the database
Definition at line 327 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, and dtn::storage::SQLiteConfigure::shutdown().
Referenced by dtn::storage::SQLiteBundleStorage::componentDown().
void dtn::storage::SQLiteDatabase::commit | ( | ) | throw (SQLiteQueryException) |
Definition at line 725 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::store().
size_t dtn::storage::SQLiteDatabase::count | ( | ) | const throw (SQLiteQueryException) |
Definition at line 804 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, and dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::count().
bool dtn::storage::SQLiteDatabase::empty | ( | ) | const throw (SQLiteQueryException) |
Definition at line 790 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::empty().
void dtn::storage::SQLiteDatabase::expire | ( | const dtn::data::Timestamp & | timestamp | ) | throw () |
Expire all bundles with a lifetime lower than the given timestamp.
timestamp |
Definition at line 858 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::core::BundleExpiredEvent::raise(), ibrcommon::File::remove(), dtn::storage::SQLiteDatabase::Statement::step(), and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::BundleSeeker.
Definition at line 445 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::SQLBundleQuery::bind(), ibrcommon::LogLevel::critical, dtn::storage::SQLiteDatabase::SQLBundleQuery::getWhere(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, and ibrcommon::Exception::what().
Referenced by dtn::storage::SQLiteBundleStorage::get().
void dtn::storage::SQLiteDatabase::get | ( | const dtn::data::BundleID & | id, |
dtn::data::MetaBundle & | meta | ||
) | const throw (SQLiteQueryException, NoBundleFoundException) |
Retrieve the meta data of a given bundle
id |
Definition at line 339 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, and dtn::storage::SQLiteDatabase::Statement::step().
void dtn::storage::SQLiteDatabase::get | ( | const dtn::data::BundleID & | id, |
dtn::data::Bundle & | bundle, | ||
blocklist & | blocks | ||
) | const throw (SQLiteQueryException, NoBundleFoundException) |
Retrieve the data of a given bundle
id |
Definition at line 536 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::storage::SQLiteDatabase::Statement::step(), and ibrcommon::Exception::what().
|
virtual |
Implements dtn::storage::BundleSeeker.
Definition at line 825 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::getDistinctDestinations().
void dtn::storage::SQLiteDatabase::iterateAll | ( | ) | throw (SQLiteQueryException) |
iterate through all the bundles and call the iterateDatabase() on each bundle
Definition at line 426 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::DatabaseListener::iterateDatabase(), dtn::storage::SQLiteDatabase::Statement::reset(), and dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::componentUp().
void dtn::storage::SQLiteDatabase::open | ( | ) | throw (SQLiteQueryException) |
open the database
Definition at line 279 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteConfigure::configure(), ibrcommon::LogLevel::critical, ibrcommon::LogLevel::error, ibrcommon::File::getPath(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_LEVEL, IBRCOMMON_LOGGER_TAG, ibrcommon::LogLevel::info, dtn::storage::sql_tracer(), and ibrcommon::LogLevel::warning.
Referenced by dtn::storage::SQLiteBundleStorage::componentUp().
void dtn::storage::SQLiteDatabase::remove | ( | const dtn::data::BundleID & | id | ) | throw (SQLiteQueryException) |
Delete an entry in the database.
id |
Definition at line 740 of file SQLiteDatabase.cpp.
References IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::File::remove(), and dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::remove().
void dtn::storage::SQLiteDatabase::rollback | ( | ) | throw (SQLiteQueryException) |
Definition at line 710 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::store().
void dtn::storage::SQLiteDatabase::setFaulty | ( | bool | mode | ) |
Set the storage to faulty. If set to true, each try to store a bundle will fail.
Definition at line 995 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::setFaulty().
void dtn::storage::SQLiteDatabase::store | ( | const dtn::data::Bundle & | bundle | ) | throw (SQLiteQueryException) |
bundle |
Definition at line 597 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, dtn::data::PrimaryBlock::FRAGMENT, dtn::data::SDNV< E >::get(), dtn::data::ScopeControlHopLimitBlock::getHopsToLive(), dtn::data::PayloadBlock::getLength(), dtn::data::SchedulingBlock::getPriority(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::storage::SQLiteDatabase::Statement::step(), and ibrcommon::LogLevel::warning.
Referenced by dtn::storage::SQLiteBundleStorage::store().
void dtn::storage::SQLiteDatabase::store | ( | const dtn::data::BundleID & | id, |
int | index, | ||
const dtn::data::Block & | block, | ||
const ibrcommon::File & | file | ||
) | throw (SQLiteQueryException) |
Definition at line 669 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
void dtn::storage::SQLiteDatabase::transaction | ( | ) | throw (SQLiteQueryException) |
Definition at line 695 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::store().
void dtn::storage::SQLiteDatabase::update | ( | UPDATE_VALUES | mode, |
const dtn::data::BundleID & | id, | ||
const dtn::data::EID & | eid | ||
) | throw (SQLiteQueryException) |
Update
id | |
Definition at line 928 of file SQLiteDatabase.cpp.
References ibrcommon::LogLevel::error, and dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::releaseCustody(), and dtn::storage::SQLiteBundleStorage::store().
void dtn::storage::SQLiteDatabase::vacuum | ( | ) | throw (SQLiteQueryException) |
Shrink down the database.
Definition at line 922 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by clear().