IBR-DTNSuite
0.8
|
#include <SQLiteDatabase.h>
Classes | |
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 |
Public Member Functions | |
SQLiteDatabase (const ibrcommon::File &file, const size_t &size) | |
virtual | ~SQLiteDatabase () |
void | open () |
void | close () |
void | expire (size_t timestamp) |
void | vacuum () |
void | update (UPDATE_VALUES, const dtn::data::BundleID &id, const dtn::data::EID &) |
void | remove (const dtn::data::BundleID &id) |
const std::list < dtn::data::MetaBundle > | get (dtn::storage::BundleStorage::BundleFilterCallback &cb) const |
void | get (const dtn::data::BundleID &id, dtn::data::MetaBundle &meta) const |
void | get (const dtn::data::BundleID &id, dtn::data::Bundle &bundle, blocklist &blocks) const |
void | store (const dtn::data::Bundle &bundle) |
void | store (const dtn::data::BundleID &id, int index, const dtn::data::Block &block, const ibrcommon::File &file) |
void | transaction () |
void | rollback () |
void | commit () |
bool | empty () const |
unsigned int | count () const |
void | clear () |
virtual const std::set < dtn::data::EID > | getDistinctDestinations () |
Definition at line 25 of file SQLiteDatabase.h.
typedef std::list<std::pair<int, const ibrcommon::File> > dtn::storage::SQLiteDatabase::blocklist |
Definition at line 141 of file SQLiteDatabase.h.
typedef std::pair<int, const ibrcommon::File> dtn::storage::SQLiteDatabase::blocklist_entry |
Definition at line 142 of file SQLiteDatabase.h.
Definition at line 87 of file SQLiteDatabase.h.
dtn::storage::SQLiteDatabase::SQLiteDatabase | ( | const ibrcommon::File & | file, |
const size_t & | size | ||
) |
Definition at line 132 of file SQLiteDatabase.cpp.
dtn::storage::SQLiteDatabase::~SQLiteDatabase | ( | ) | [virtual] |
Definition at line 137 of file SQLiteDatabase.cpp.
void dtn::storage::SQLiteDatabase::clear | ( | ) |
Definition at line 823 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 273 of file SQLiteDatabase.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and dtn::storage::SQLiteConfigure::shutdown().
Referenced by dtn::storage::SQLiteBundleStorage::componentDown().
void dtn::storage::SQLiteDatabase::commit | ( | ) |
Definition at line 776 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::store().
unsigned int dtn::storage::SQLiteDatabase::count | ( | ) | const |
Definition at line 854 of file SQLiteDatabase.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::count().
bool dtn::storage::SQLiteDatabase::empty | ( | ) | const |
Definition at line 840 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by dtn::storage::SQLiteBundleStorage::empty().
void dtn::storage::SQLiteDatabase::expire | ( | size_t | timestamp | ) |
Expire all bundles with a lifetime lower than the given timestamp.
timestamp |
Definition at line 898 of file SQLiteDatabase.cpp.
References dtn::core::BundleExpiredEvent::raise(), ibrcommon::File::remove(), and dtn::storage::SQLiteDatabase::Statement::step().
const std::list< dtn::data::MetaBundle > dtn::storage::SQLiteDatabase::get | ( | dtn::storage::BundleStorage::BundleFilterCallback & | cb | ) | const |
Get meta data of several bundles using a callback filter.
cb |
Definition at line 508 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::SQLBundleQuery::bind(), dtn::storage::SQLiteDatabase::SQLBundleQuery::getWhere(), and dtn::storage::BundleStorage::BundleFilterCallback::limit().
Referenced by dtn::storage::SQLiteBundleStorage::get().
void dtn::storage::SQLiteDatabase::get | ( | const dtn::data::BundleID & | id, |
dtn::data::MetaBundle & | meta | ||
) | const |
Retrieve the meta data of a given bundle
id |
Definition at line 437 of file SQLiteDatabase.cpp.
References IBRCOMMON_LOGGER_DEBUG, 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 |
Retrieve the data of a given bundle
id |
Definition at line 597 of file SQLiteDatabase.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, dtn::storage::SQLiteDatabase::Statement::step(), and ibrcommon::Exception::what().
const std::set< dtn::data::EID > dtn::storage::SQLiteDatabase::getDistinctDestinations | ( | ) | [virtual] |
Definition at line 876 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::getDistinctDestinations().
void dtn::storage::SQLiteDatabase::open | ( | ) |
open the database
Definition at line 223 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteConfigure::configure(), ibrcommon::File::getPath(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_LEVEL, and dtn::storage::sql_tracer().
Referenced by dtn::storage::SQLiteBundleStorage::componentUp().
void dtn::storage::SQLiteDatabase::remove | ( | const dtn::data::BundleID & | id | ) |
Delete an entry in the database.
id |
Definition at line 782 of file SQLiteDatabase.cpp.
References IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::File::remove(), and dtn::storage::SQLiteDatabase::Statement::step().
Definition at line 770 of file SQLiteDatabase.cpp.
Referenced by dtn::storage::SQLiteBundleStorage::store().
void dtn::storage::SQLiteDatabase::store | ( | const dtn::data::Bundle & | bundle | ) |
bundle |
Definition at line 667 of file SQLiteDatabase.cpp.
References dtn::data::PrimaryBlock::_appdatalength, dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::_destination, dtn::data::PrimaryBlock::_lifetime, dtn::data::PrimaryBlock::_procflags, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_source, dtn::data::PrimaryBlock::_timestamp, dtn::data::PrimaryBlock::FRAGMENT, dtn::data::PrimaryBlock::get(), dtn::data::Bundle::getBlock(), dtn::data::ScopeControlHopLimitBlock::getHopsToLive(), dtn::data::PayloadBlock::getLength(), dtn::data::EID::getString(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, 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 | ||
) |
Definition at line 735 of file SQLiteDatabase.cpp.
References ibrcommon::File::getPath(), dtn::data::Block::getType(), and dtn::storage::SQLiteDatabase::Statement::step().
Definition at line 764 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 | ||
) |
Update
id | |
Definition at line 955 of file SQLiteDatabase.cpp.
References dtn::data::EID::getString(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::storage::SQLiteDatabase::Statement::step(), and UPDATE_CUSTODIAN.
Referenced by dtn::storage::SQLiteBundleStorage::releaseCustody(), and dtn::storage::SQLiteBundleStorage::store().
void dtn::storage::SQLiteDatabase::vacuum | ( | ) |
Shrink down the database.
Definition at line 949 of file SQLiteDatabase.cpp.
References dtn::storage::SQLiteDatabase::Statement::step().
Referenced by clear().