IBR-DTNSuite  0.10
dtn::storage::SQLiteDatabase Class Reference

#include <SQLiteDatabase.h>

Inheritance diagram for dtn::storage::SQLiteDatabase:
Inheritance graph
Collaboration diagram for dtn::storage::SQLiteDatabase:
Collaboration graph

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
 
- Public Types inherited from dtn::storage::BundleSeeker
typedef std::set< dtn::data::EIDeid_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 &timestamp) 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)
 
- Public Member Functions inherited from dtn::storage::BundleSeeker
virtual ~BundleSeeker ()
 

Detailed Description

Definition at line 40 of file SQLiteDatabase.h.

Member Typedef Documentation

typedef std::list<std::pair<int, const ibrcommon::File> > dtn::storage::SQLiteDatabase::blocklist

Definition at line 165 of file SQLiteDatabase.h.

Definition at line 166 of file SQLiteDatabase.h.

Member Enumeration Documentation

Enumerator
UPDATE_CUSTODIAN 

Definition at line 103 of file SQLiteDatabase.h.

Constructor & Destructor Documentation

dtn::storage::SQLiteDatabase::SQLiteDatabase ( const ibrcommon::File file,
DatabaseListener listener 
)

Definition at line 175 of file SQLiteDatabase.cpp.

dtn::storage::SQLiteDatabase::~SQLiteDatabase ( )
virtual

Definition at line 180 of file SQLiteDatabase.cpp.

Member Function Documentation

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().

Here is the call graph for this function:

void dtn::storage::SQLiteDatabase::close ( )

close the database

Returns

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void dtn::storage::SQLiteDatabase::expire ( const dtn::data::Timestamp timestamp) throw ()

Expire all bundles with a lifetime lower than the given timestamp.

Parameters
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().

Here is the call graph for this function:

void dtn::storage::SQLiteDatabase::get ( const BundleSelector cb,
BundleResult result 
) throw (NoBundleFoundException, BundleSelectorException, BundleSelectorException)
virtual
See Also
BundleSeeker::get(BundleSelector &cb, BundleResult &result)

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().

Here is the call graph for this function:

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

Parameters
id
Returns

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().

Here is the call graph for this function:

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

Parameters
id
Returns

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().

Here is the call graph for this function:

const std::set< dtn::data::EID > dtn::storage::SQLiteDatabase::getDistinctDestinations ( ) throw (SQLiteQueryException)
virtual
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().

Here is the call graph for this function:

void dtn::storage::SQLiteDatabase::remove ( const dtn::data::BundleID id) throw (SQLiteQueryException)

Delete an entry in the database.

Parameters
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().

Here is the call graph for this function:

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::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().

Here is the call graph for this function:

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

Parameters
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:


The documentation for this class was generated from the following files: