oasys::DurableStore Class Reference

#include <DurableStore.h>

Inheritance diagram for oasys::DurableStore:

oasys::Logger List of all members.

Detailed Description

Interface for the generic datastore.

Definition at line 1800 of file DurableStore.h.

Public Member Functions

 DurableStore (const char *logpath)
 ~DurableStore ()
int create_store (const StorageConfig &config, bool *clean_shutdown=NULL)
DurableStoreImplimpl ()
 Return the implementation pointer.
template<typename _DataType>
int get_table (SingleTypeDurableTable< _DataType > **table, std::string table_name, int flags, DurableObjectCache< _DataType > *cache=NULL)
 Get a new handle on a single-type table.
template<typename _BaseType, typename _Collection>
int get_table (MultiTypeDurableTable< _BaseType, _Collection > **table, std::string table_name, int flags, DurableObjectCache< _BaseType > *cache=NULL)
 Get a new handle on a table.
int get_table (StaticTypedDurableTable **table, std::string table_name, int flags, DurableObjectCache< SerializableObject > *cache=NULL)
 Get a new handle on a table.
int del_table (std::string table_name)
 Delete the table (by id) from the datastore.
int get_table_names (StringVector *table_names)
std::string get_info () const

Private Types

typedef DurableStoreImpl::PrototypeVector PrototypeVector
 Typedef for the list of objects passed to the implementation to initialize the table.

Private Member Functions

 DurableStore (const DurableStore &other)
 The copy constructor should never be called.

Private Attributes

DurableStoreImplimpl_
 the storage implementation
std::string clean_shutdown_file_
 path to the special shutdown file


Member Typedef Documentation

typedef DurableStoreImpl::PrototypeVector oasys::DurableStore::PrototypeVector [private]

Typedef for the list of objects passed to the implementation to initialize the table.

Definition at line 1900 of file DurableStore.h.


Constructor & Destructor Documentation

oasys::DurableStore::DurableStore ( const char *  logpath  )  [inline]

Initialize the DurableStore object. Note that create_store() must be called before it can be used.

Definition at line 1806 of file DurableStore.h.

oasys::DurableStore::~DurableStore (  ) 

Shut down the durable store.

Definition at line 31 of file DurableStore.cc.

References clean_shutdown_file_, errno, fd, impl_, log_debug, and log_err.

oasys::DurableStore::DurableStore ( const DurableStore other  )  [private]

The copy constructor should never be called.


Member Function Documentation

int oasys::DurableStore::create_store ( const StorageConfig config,
bool clean_shutdown = NULL 
)

Creation function for creating the right kind of database backend implementation for a given StorageConfig.

Also initializes the store and returns whether or not the store was cleanly shut down in the previous run.

Definition at line 53 of file DurableStore.cc.

References ASSERT, clean_shutdown_file_, oasys::StorageConfig::dbdir_, oasys::DS_ERR, errno, impl_, oasys::DurableStoreImpl::init(), oasys::StorageConfig::init_, oasys::StorageConfig::leave_clean_file_, log_crit, log_err, log_info, oasys::Logger::logpath_, and oasys::StorageConfig::type_.

Referenced by dtn::DTNServer::init_datastore().

DurableStoreImpl* oasys::DurableStore::impl (  )  [inline]

Return the implementation pointer.

Definition at line 1827 of file DurableStore.h.

template<typename _DataType>
int oasys::DurableStore::get_table ( SingleTypeDurableTable< _DataType > **  table,
std::string  table_name,
int  flags,
DurableObjectCache< _DataType > *  cache = NULL 
) [inline]

Get a new handle on a single-type table.

Parameters:
table Pointer to the table to be created
table_name Name of the table
flags Options for creating the table
cache Optional cache for the table
Returns:
DS_OK, DS_NOTFOUND, DS_EXISTS, DS_ERR

Definition at line 1946 of file DurableStore.h.

Referenced by dtn::GlobalStore::do_init().

template<typename _BaseType, typename _Collection>
int oasys::DurableStore::get_table ( MultiTypeDurableTable< _BaseType, _Collection > **  table,
std::string  table_name,
int  flags,
DurableObjectCache< _BaseType > *  cache = NULL 
) [inline]

Get a new handle on a table.

Parameters:
table Pointer to the table to be created
table_name Name of the table
flags Options for creating the table
cache Optional cache for the table
Returns:
DS_OK, DS_NOTFOUND, DS_EXISTS, DS_ERR

Definition at line 1978 of file DurableStore.h.

int oasys::DurableStore::get_table ( StaticTypedDurableTable **  table,
std::string  table_name,
int  flags,
DurableObjectCache< SerializableObject > *  cache = NULL 
)

Get a new handle on a table.

Parameters:
table Pointer to the table to be created
flags Options for creating the table
table_name Name of the table
cache Optional cache for the table
Returns:
DS_OK, DS_NOTFOUND, DS_EXISTS, DS_ERR

Definition at line 131 of file DurableStore.cc.

References ASSERT, oasys::DurableStoreImpl::get_table(), and impl_.

int oasys::DurableStore::del_table ( std::string  table_name  )  [inline]

Delete the table (by id) from the datastore.

Delete the table (by name) from the datastore.

Definition at line 2048 of file DurableStore.h.

int oasys::DurableStore::get_table_names ( StringVector table_names  ) 

Retrieve a list of all of the tables in the database.

Parameters:
table_list Vector will be filled with list of all of the table names.
Returns:
DS_OK, DS_ERR

Definition at line 154 of file DurableStore.cc.

References oasys::DurableStoreImpl::get_table_names(), and impl_.

std::string oasys::DurableStore::get_info (  )  const

Get descriptive information about the store.

Returns:
Text string describing storage configuration.

Definition at line 162 of file DurableStore.cc.

References oasys::DurableStoreImpl::get_info(), and impl_.


Member Data Documentation

DurableStoreImpl* oasys::DurableStore::impl_ [private]

the storage implementation

Definition at line 1905 of file DurableStore.h.

Referenced by create_store(), get_info(), get_table(), get_table_names(), and ~DurableStore().

std::string oasys::DurableStore::clean_shutdown_file_ [private]

path to the special shutdown file

Definition at line 1907 of file DurableStore.h.

Referenced by create_store(), and ~DurableStore().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 12:54:36 2007 for DTN Reference Implementation by  doxygen 1.5.1