IBR-DTN
1.0.0
|
#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) |
dtn::data::Length | remove (const dtn::data::BundleID &id) throw (SQLiteQueryException) |
virtual void | get (const BundleSelector &cb, BundleResult &result) throw (NoBundleFoundException, 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, const dtn::data::Length &size) 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) |
bool | contains (const dtn::data::BundleID &id) throw (SQLiteDatabase::SQLiteQueryException) |
virtual const eid_set | getDistinctDestinations () throw (SQLiteQueryException) |
void | iterateAll () throw (SQLiteQueryException) |
void | setFaulty (bool mode) |
![]() | |
virtual | ~BundleSeeker () |
Friends | |
class | SQLiteBundleSet |
Definition at line 40 of file SQLiteDatabase.h.
typedef std::list<std::pair<int, const ibrcommon::File> > dtn::storage::SQLiteDatabase::blocklist |
Definition at line 187 of file SQLiteDatabase.h.
typedef std::pair<int, const ibrcommon::File> dtn::storage::SQLiteDatabase::blocklist_entry |
Definition at line 188 of file SQLiteDatabase.h.
Enumerator | |
---|---|
UPDATE_CUSTODIAN |
Definition at line 125 of file SQLiteDatabase.h.
dtn::storage::SQLiteDatabase::SQLiteDatabase | ( | const ibrcommon::File & | file, |
DatabaseListener & | listener | ||
) |
Definition at line 204 of file SQLiteDatabase.cpp.
|
virtual |
Definition at line 209 of file SQLiteDatabase.cpp.
void dtn::storage::SQLiteDatabase::clear | ( | ) | ||
throw | ( | SQLiteQueryException | ||
) |
Definition at line 826 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 352 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteConfigure::shutdown().
Referenced by dtn::storage::SQLiteBundleStorage::~SQLiteBundleStorage().
void dtn::storage::SQLiteDatabase::commit | ( | ) | ||
throw | ( | SQLiteQueryException | ||
) |
Definition at line 753 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::store().
bool dtn::storage::SQLiteDatabase::contains | ( | const dtn::data::BundleID & | id | ) | |
throw | ( | SQLiteDatabase::SQLiteQueryException | |||
) |
Returns true, if the bundle ID is stored in the database
Definition at line 843 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::contains().
size_t dtn::storage::SQLiteDatabase::count | ( | ) | const | |
throw | ( | SQLiteQueryException | ||
) |
Definition at line 869 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::count().
bool dtn::storage::SQLiteDatabase::empty | ( | ) | const | |
throw | ( | SQLiteQueryException | ||
) |
Definition at line 855 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 923 of file SQLiteDatabase.cpp.
References dtn::core::BundleExpiredEvent::raise(), and dtn::storage::SQLiteDatabase::Statement::step().
|
virtual |
Implements dtn::storage::BundleSeeker.
Definition at line 475 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::SQLBundleQuery::bind(), and dtn::storage::SQLiteDatabase::SQLBundleQuery::getWhere().
Referenced by dtn::storage::SQLiteBundleStorage::get(), and dtn::storage::SQLiteBundleStorage::info().
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 364 of file SQLiteDatabase.cpp.
References 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 565 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
|
virtual |
Implements dtn::storage::BundleSeeker.
Definition at line 890 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 457 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 305 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteConfigure::configure(), and dtn::storage::sql_tracer().
Referenced by dtn::storage::SQLiteBundleStorage::SQLiteBundleStorage().
dtn::data::Length dtn::storage::SQLiteDatabase::remove | ( | const dtn::data::BundleID & | id | ) | |
throw | ( | SQLiteQueryException | |||
) |
Delete an entry in the database.
id |
Definition at line 768 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::remove().
void dtn::storage::SQLiteDatabase::rollback | ( | ) | ||
throw | ( | SQLiteQueryException | ||
) |
Definition at line 738 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 1065 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::setFaulty().
void dtn::storage::SQLiteDatabase::store | ( | const dtn::data::Bundle & | bundle, |
const dtn::data::Length & | size | ||
) | |||
throw | ( | SQLiteQueryException | |
) |
bundle |
Definition at line 626 of file SQLiteDatabase.cpp.
References dtn::data::PrimaryBlock::FRAGMENT, dtn::data::SDNV< E >::get(), dtn::utils::Clock::getExpireTime(), dtn::data::ScopeControlHopLimitBlock::getHopsToLive(), dtn::data::SchedulingBlock::getPriority(), and dtn::storage::SQLiteDatabase::Statement::step().
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 697 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
void dtn::storage::SQLiteDatabase::transaction | ( | ) | ||
throw | ( | SQLiteQueryException | ||
) |
Definition at line 723 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 1007 of file SQLiteDatabase.cpp.
References 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 1001 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by clear().
|
friend |
Definition at line 42 of file SQLiteDatabase.h.