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

#include <DataStorage.h>

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

Classes

class  Callback
 
class  Container
 
class  DataNotAvailableException
 
class  Hash
 
class  istream
 

Public Member Functions

 DataStorage (Callback &callback, const ibrcommon::File &path, unsigned int write_buffer=0, bool initialize=false)
 
virtual ~DataStorage ()
 
const Hash store (Container *data)
 
void store (const Hash &hash, Container *data)
 
DataStorage::istream retrieve (const Hash &hash) throw (DataNotAvailableException)
 
void remove (const Hash &hash)
 
void wait ()
 
void iterateAll ()
 
void reset ()
 
void setFaulty (bool mode)
 
- Public 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 ()
 

Protected Member Functions

void run () throw ()
 
void __cancellation () throw ()
 
- Protected Member Functions inherited from ibrcommon::JoinableThread
 JoinableThread (size_t size=DEFAULT_STACKSIZE)
 
- Protected Member Functions inherited from ibrcommon::Thread
virtual ~Thread ()=0
 
void reset () throw (ThreadException)
 
virtual void setup (void) throw ()
 
virtual void finally (void) throw ()
 
bool isFinalized () throw ()
 
bool operator== (const ibrcommon::Thread &other)
 
 Thread (size_t stack=DEFAULT_STACKSIZE)
 
int kill (int sig)
 
void cancel () throw ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from ibrcommon::Thread
static size_t getNumberOfProcessors ()
 
static void yield (void)
 
static void sleep (time_t timeout)
 
static void concurrency (int level)
 
static bool equal (pthread_t thread1, pthread_t thread2)
 
static void * __execute__ (void *obj) throw ()
 

Detailed Description

Definition at line 40 of file DataStorage.h.

Constructor & Destructor Documentation

dtn::storage::DataStorage::DataStorage ( Callback callback,
const ibrcommon::File path,
unsigned int  write_buffer = 0,
bool  initialize = false 
)

Definition at line 93 of file DataStorage.cpp.

References ibrcommon::File::createDirectory(), ibrcommon::File::exists(), and ibrcommon::File::getFiles().

Here is the call graph for this function:

dtn::storage::DataStorage::~DataStorage ( )
virtual

Definition at line 119 of file DataStorage.cpp.

References ibrcommon::Queue< T >::abort(), ibrcommon::Queue< T >::getnpop(), and ibrcommon::JoinableThread::join().

Here is the call graph for this function:

Member Function Documentation

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

Implements ibrcommon::Thread.

Definition at line 202 of file DataStorage.cpp.

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

Here is the call graph for this function:

void dtn::storage::DataStorage::iterateAll ( )

iterate through all the data and call the iterateDataStorage() on each dataset

Definition at line 146 of file DataStorage.cpp.

References ibrcommon::File::getFiles(), and dtn::storage::DataStorage::Callback::iterateDataStorage().

Referenced by dtn::storage::SimpleBundleStorage::componentUp().

Here is the call graph for this function:

void dtn::storage::DataStorage::remove ( const Hash hash)
void dtn::storage::DataStorage::reset ( )

reset the data storage

Definition at line 136 of file DataStorage.cpp.

Referenced by dtn::storage::SimpleBundleStorage::componentDown().

DataStorage::istream dtn::storage::DataStorage::retrieve ( const Hash hash) throw (DataNotAvailableException)

Definition at line 180 of file DataStorage.cpp.

References ibrcommon::File::exists(), ibrcommon::File::get(), and ibrcommon::File::getPath().

Referenced by dtn::storage::SimpleBundleStorage::get().

Here is the call graph for this function:

void dtn::storage::DataStorage::setFaulty ( bool  mode)

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

Definition at line 141 of file DataStorage.cpp.

Referenced by dtn::storage::SimpleBundleStorage::setFaulty().

const DataStorage::Hash dtn::storage::DataStorage::store ( DataStorage::Container data)

Definition at line 172 of file DataStorage.cpp.

Referenced by run().

void dtn::storage::DataStorage::store ( const Hash hash,
DataStorage::Container data 
)

Definition at line 163 of file DataStorage.cpp.

References ibrcommon::Queue< T >::push(), and ibrcommon::Semaphore::wait().

Here is the call graph for this function:

void dtn::storage::DataStorage::wait ( )

wait until all tasks are completed

Definition at line 197 of file DataStorage.cpp.

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

Referenced by dtn::storage::SimpleBundleStorage::componentDown(), and dtn::storage::SimpleBundleStorage::wait().

Here is the call graph for this function:


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