IBR-DTNSuite  0.12
dtn::storage::SQLiteBundleStorage Class Reference

#include <SQLiteBundleStorage.h>

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

Public Member Functions

ibrcommon::BLOB::Reference create ()
 
 SQLiteBundleStorage (const ibrcommon::File &path, const dtn::data::Length &maxsize, bool usePersistentBundleSets=false)
 
virtual ~SQLiteBundleStorage ()
 
void store (const dtn::data::Bundle &bundle)
 
bool contains (const dtn::data::BundleID &id)
 
virtual dtn::data::MetaBundle info (const dtn::data::BundleID &id)
 
dtn::data::Bundle get (const dtn::data::BundleID &id)
 
virtual void get (const BundleSelector &cb, BundleResult &result) throw (NoBundleFoundException, BundleSelectorException)
 
virtual const eid_set getDistinctDestinations ()
 
void remove (const dtn::data::BundleID &id)
 
void clear ()
 
bool empty ()
 
dtn::data::Size count ()
 
void releaseCustody (const dtn::data::EID &custodian, const dtn::data::BundleID &id)
 
void raiseEvent (const dtn::core::Event *evt) throw ()
 
void eventBundleExpired (const dtn::data::BundleID &id, const dtn::data::Length size) throw ()
 
void iterateDatabase (const dtn::data::MetaBundle &bundle, const dtn::data::Length size)
 
virtual void wait ()
 
virtual void setFaulty (bool mode)
 
- Public Member Functions inherited from dtn::storage::BundleStorage
virtual ~BundleStorage ()=0
 
void remove (const dtn::data::Bundle &b)
 
dtn::data::Length size () const
 
const dtn::data::EID acceptCustody (const dtn::data::MetaBundle &meta)
 
void rejectCustody (const dtn::data::MetaBundle &meta, dtn::data::CustodySignalBlock::REASON_CODE reason=dtn::data::CustodySignalBlock::NO_ADDITIONAL_INFORMATION)
 
void attach (dtn::storage::BundleIndex *index)
 
void detach (dtn::storage::BundleIndex *index)
 
- Public Member Functions inherited from dtn::storage::BundleSeeker
virtual ~BundleSeeker ()
 
- Public Member Functions inherited from dtn::core::EventReceiver
virtual ~EventReceiver ()=0
 
- Public Member Functions inherited from dtn::daemon::IndependentComponent
 IndependentComponent ()
 
virtual ~IndependentComponent ()
 
virtual void initialize () throw ()
 
virtual void startup () throw ()
 
virtual void terminate () throw ()
 
- Public Member Functions inherited from dtn::daemon::Component
virtual ~Component ()=0
 
- Public Member Functions inherited from ibrcommon::BLOB::Provider
virtual ~Provider ()=0
 
- Public Member Functions inherited from dtn::storage::SQLiteDatabase::DatabaseListener
virtual ~DatabaseListener ()=0
 

Protected Member Functions

virtual void componentRun () throw ()
 
virtual void componentUp () throw ()
 
virtual void componentDown () throw ()
 
void __cancellation () throw ()
 
- Protected Member Functions inherited from dtn::storage::BundleStorage
 BundleStorage (const dtn::data::Length &maxsize)
 
void allocSpace (const dtn::data::Length &size) throw (StorageSizeExeededException)
 
void freeSpace (const dtn::data::Length &size) throw ()
 
void clearSpace () throw ()
 
void eventBundleAdded (const dtn::data::MetaBundle &b) throw ()
 
void eventBundleRemoved (const dtn::data::BundleID &id) throw ()
 
- Protected Member Functions inherited from dtn::daemon::IndependentComponent
void run () throw ()
 
- Protected Member Functions inherited from ibrcommon::JoinableThread
virtual ~JoinableThread ()=0
 
void join (void) throw (ThreadException)
 
bool isRunning (void)
 
void start (int priority=0) throw (ThreadException)
 
void stop () throw ()
 
 JoinableThread (size_t size=DEFAULT_STACKSIZE)
 

Additional Inherited Members

- Public Types inherited from dtn::storage::BundleSeeker
typedef std::set< dtn::data::EIDeid_set
 
- Protected Attributes inherited from dtn::storage::BundleStorage
bool _faulty
 

Detailed Description

Definition at line 50 of file SQLiteBundleStorage.h.

Constructor & Destructor Documentation

dtn::storage::SQLiteBundleStorage::SQLiteBundleStorage ( const ibrcommon::File path,
const dtn::data::Length maxsize,
bool  usePersistentBundleSets = false 
)

Constructor

Parameters
Pfadzum Ordner in denen die Datein gespeichert werden.
Dateinameder Datenbank
maximaleGröße der Datenbank
shouldbundleSets be stored persistently in database? standard: false

Definition at line 115 of file SQLiteBundleStorage.cpp.

References ibrcommon::BLOB::changeProvider(), ibrcommon::File::createDirectory(), ibrcommon::LogLevel::critical, ibrcommon::File::get(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::SQLiteDatabase::open(), ibrcommon::File::remove(), dtn::data::BundleSet::setFactory(), and ibrcommon::Exception::what().

Here is the call graph for this function:

dtn::storage::SQLiteBundleStorage::~SQLiteBundleStorage ( )
virtual

Member Function Documentation

void dtn::storage::SQLiteBundleStorage::__cancellation ( )
throw (
)
protectedvirtual

This method is called after componentDown() and should should guarantee that blocking calls in componentRun() will unblock.

Implements dtn::daemon::IndependentComponent.

Definition at line 221 of file SQLiteBundleStorage.cpp.

References ibrcommon::Queue< T >::abort().

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::clear ( )
virtual
void dtn::storage::SQLiteBundleStorage::componentDown ( )
throw (
)
protectedvirtual

This method is called if the component should stop. Clean-up code should be inserted here.

Implements dtn::daemon::IndependentComponent.

Definition at line 209 of file SQLiteBundleStorage.cpp.

References ibrcommon::JoinableThread::join(), dtn::core::EventDispatcher< E >::remove(), and ibrcommon::JoinableThread::stop().

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::componentRun ( )
throw (
)
protectedvirtual

This is the run method. The component should loop in there until componentDown() or __cancellation() is called.

Implements dtn::daemon::IndependentComponent.

Definition at line 163 of file SQLiteBundleStorage.cpp.

References ibrcommon::Queue< T >::getnpop().

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::componentUp ( )
throw (
)
protectedvirtual

Is called in preparation of the component. Before componentRun() is called.

Implements dtn::daemon::IndependentComponent.

Definition at line 193 of file SQLiteBundleStorage.cpp.

References dtn::core::EventDispatcher< E >::add(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::storage::SQLiteDatabase::iterateAll(), and ibrcommon::Exception::what().

Here is the call graph for this function:

bool dtn::storage::SQLiteBundleStorage::contains ( const dtn::data::BundleID id)
virtual

This method returns true if the requested bundle is stored in the storage.

Implements dtn::storage::BundleStorage.

Definition at line 467 of file SQLiteBundleStorage.cpp.

References dtn::storage::SQLiteDatabase::contains(), and ibrcommon::RWMutex::LOCK_READONLY.

Here is the call graph for this function:

dtn::data::Size dtn::storage::SQLiteBundleStorage::count ( )
virtual
Returns
the count of bundles in the storage

Reimplemented from dtn::storage::BundleStorage.

Definition at line 532 of file SQLiteBundleStorage.cpp.

References dtn::storage::SQLiteDatabase::count(), ibrcommon::LogLevel::critical, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, and ibrcommon::Exception::what().

Here is the call graph for this function:

ibrcommon::BLOB::Reference dtn::storage::SQLiteBundleStorage::create ( )
virtual

create a new BLOB object within this storage

Returns

Implements ibrcommon::BLOB::Provider.

Definition at line 110 of file SQLiteBundleStorage.cpp.

bool dtn::storage::SQLiteBundleStorage::empty ( )
virtual
Returns
True, if no bundles in the storage.

Reimplemented from dtn::storage::BundleStorage.

Definition at line 521 of file SQLiteBundleStorage.cpp.

References ibrcommon::LogLevel::critical, dtn::storage::SQLiteDatabase::empty(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READONLY, and ibrcommon::Exception::what().

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::eventBundleExpired ( const dtn::data::BundleID id,
const dtn::data::Length  size 
)
throw (
)
virtual

callbacks for the sqlite database

Implements dtn::storage::SQLiteDatabase::DatabaseListener.

Definition at line 642 of file SQLiteBundleStorage.cpp.

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

Implements dtn::storage::BundleStorage.

Definition at line 237 of file SQLiteBundleStorage.cpp.

References ibrcommon::RWMutex::LOCK_READONLY.

dtn::data::MetaBundle dtn::storage::SQLiteBundleStorage::info ( const dtn::data::BundleID id)
virtual

Get meta data about a specific bundle ID

Implements dtn::storage::BundleStorage.

Definition at line 477 of file SQLiteBundleStorage.cpp.

References dtn::storage::SQLiteDatabase::get(), and ibrcommon::RWMutex::LOCK_READONLY.

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::iterateDatabase ( const dtn::data::MetaBundle bundle,
const dtn::data::Length  size 
)
virtual
void dtn::storage::SQLiteBundleStorage::raiseEvent ( const dtn::core::Event evt)
throw (
)
virtual
void dtn::storage::SQLiteBundleStorage::releaseCustody ( const dtn::data::EID custodian,
const dtn::data::BundleID id 
)
virtual
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.

Parameters
idThe ID of the bundle to remove.

Implements dtn::storage::BundleStorage.

Definition at line 489 of file SQLiteBundleStorage.cpp.

References ibrcommon::LogLevel::critical, dtn::storage::BundleStorage::eventBundleRemoved(), dtn::storage::BundleStorage::freeSpace(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::RWMutex::LOCK_READWRITE, dtn::storage::SQLiteDatabase::remove(), and ibrcommon::Exception::what().

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::setFaulty ( bool  mode)
virtual

Set the storage to faulty. If set to true, each try to store or retrieve a bundle will fail.

Reimplemented from dtn::storage::BundleStorage.

Definition at line 656 of file SQLiteBundleStorage.cpp.

References dtn::storage::BundleStorage::_faulty, and dtn::storage::SQLiteDatabase::setFaulty().

Here is the call graph for this function:

void dtn::storage::SQLiteBundleStorage::wait ( )
virtual

Wait until all the data has been stored to the disk

Reimplemented from dtn::storage::BundleStorage.

Definition at line 651 of file SQLiteBundleStorage.cpp.

References ibrcommon::Queue< T >::wait().

Here is the call graph for this function:


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