oasys::FileSystemStore Class Reference

#include <FileSystemStore.h>

Inheritance diagram for oasys::FileSystemStore:

oasys::DurableStoreImpl oasys::Logger List of all members.

Detailed Description

The most obvious layering of backing store -- use the file system directly.

NEW: Now with a level of indirection!

Definition at line 47 of file FileSystemStore.h.

Public Member Functions

 FileSystemStore (const char *logpath)
FileSystemStoreoperator= (const FileSystemStore &)
 FileSystemStore (const FileSystemStore &)
 ~FileSystemStore ()
int init (const StorageConfig &cfg)
 virtual from DurableStoreImpl
int get_table (DurableTableImpl **table, const std::string &name, int flags, PrototypeVector &prototypes)
 virtual from DurableStoreImpl
int del_table (const std::string &name)
 virtual from DurableStoreImpl
int get_table_names (StringVector *names)
 virtual from DurableStoreImpl
std::string get_info () const
 virtual from DurableStoreImpl

Private Types

typedef oasys::OpenFdCache<
std::string > 
FdCache

Private Member Functions

int check_database ()
 Check for the existance of databases.
int init_database ()
 Create the database.
void tidy_database ()
 Wipe the database.
int acquire_table (const std::string &table)
 Changes the ref count on the tables.
int release_table (const std::string &table)
 Changes the ref count on the tables.

Private Attributes

bool init_
std::string db_dir_
 parent directory for the db
std::string tables_dir_
 directory where the tables are stored
RefCountMap ref_count_
int default_perm_
 Default permissions on database files.
FdCachefd_cache_

Friends

class FileSystemTable


Member Typedef Documentation

typedef oasys::OpenFdCache<std::string> oasys::FileSystemStore::FdCache [private]

Definition at line 50 of file FileSystemStore.h.


Constructor & Destructor Documentation

oasys::FileSystemStore::FileSystemStore ( const char *  logpath  ) 

Definition at line 38 of file FileSystemStore.cc.

oasys::FileSystemStore::FileSystemStore ( const FileSystemStore  ) 

oasys::FileSystemStore::~FileSystemStore (  ) 

Definition at line 47 of file FileSystemStore.cc.


Member Function Documentation

FileSystemStore& oasys::FileSystemStore::operator= ( const FileSystemStore  ) 

int oasys::FileSystemStore::init ( const StorageConfig cfg  )  [virtual]

virtual from DurableStoreImpl

Implements oasys::DurableStoreImpl.

Definition at line 52 of file FileSystemStore.cc.

References oasys::FileUtils::abspath(), check_database(), db_dir_, oasys::StorageConfig::dbdir_, oasys::StorageConfig::dbname_, fd_cache_, oasys::StorageConfig::fs_fd_cache_size_, init_, oasys::StorageConfig::init_, init_database(), log_err, log_info, oasys::Logger::logpath_, tables_dir_, tidy, oasys::StorageConfig::tidy_, and tidy_database().

int oasys::FileSystemStore::get_table ( DurableTableImpl **  table,
const std::string &  name,
int  flags,
PrototypeVector prototypes 
)

virtual from DurableStoreImpl

Definition at line 115 of file FileSystemStore.cc.

References ASSERT, default_perm_, oasys::DS_CREATE, oasys::DS_ERR, oasys::DS_EXCL, oasys::DS_EXISTS, oasys::DS_MULTITYPE, oasys::DS_NOTFOUND, errno, fd_cache_, FileSystemTable, init_, log_err, oasys::Logger::logpath_, and tables_dir_.

int oasys::FileSystemStore::del_table ( const std::string &  name  )  [virtual]

virtual from DurableStoreImpl

Implements oasys::DurableStoreImpl.

Definition at line 164 of file FileSystemStore.cc.

References ASSERT, errno, init_, log_warn, oasys::FileUtils::rm_all_from_dir(), and tables_dir_.

int oasys::FileSystemStore::get_table_names ( StringVector names  )  [virtual]

virtual from DurableStoreImpl

Implements oasys::DurableStoreImpl.

Definition at line 188 of file FileSystemStore.cc.

References oasys::DS_ERR, log_err, and tables_dir_.

std::string oasys::FileSystemStore::get_info (  )  const [virtual]

virtual from DurableStoreImpl

Implements oasys::DurableStoreImpl.

Definition at line 211 of file FileSystemStore.cc.

int oasys::FileSystemStore::check_database (  )  [private]

Check for the existance of databases.

Returns:
0 on no error.

-2 if the database file doesn't exist. Otherwise -1.

Definition at line 220 of file FileSystemStore.cc.

References errno, and tables_dir_.

Referenced by init().

int oasys::FileSystemStore::init_database (  )  [private]

Create the database.

Returns:
0 on no error.

Definition at line 237 of file FileSystemStore.cc.

References db_dir_, default_perm_, errno, log_notice, log_warn, and tables_dir_.

Referenced by init().

void oasys::FileSystemStore::tidy_database (  )  [private]

Wipe the database.

Returns:
0 on no error.

Definition at line 258 of file FileSystemStore.cc.

References ASSERT, db_dir_, log_notice, and snprintf().

Referenced by init().

int oasys::FileSystemStore::acquire_table ( const std::string &  table  )  [private]

Changes the ref count on the tables.

int oasys::FileSystemStore::release_table ( const std::string &  table  )  [private]

Changes the ref count on the tables.


Friends And Related Function Documentation

friend class FileSystemTable [friend]

Definition at line 48 of file FileSystemStore.h.

Referenced by get_table().


Member Data Documentation

bool oasys::FileSystemStore::init_ [private]

Definition at line 73 of file FileSystemStore.h.

Referenced by del_table(), get_table(), and init().

std::string oasys::FileSystemStore::db_dir_ [private]

parent directory for the db

Definition at line 74 of file FileSystemStore.h.

Referenced by init(), init_database(), and tidy_database().

std::string oasys::FileSystemStore::tables_dir_ [private]

directory where the tables are stored

Definition at line 75 of file FileSystemStore.h.

Referenced by check_database(), del_table(), get_table(), get_table_names(), init(), and init_database().

RefCountMap oasys::FileSystemStore::ref_count_ [private]

Definition at line 77 of file FileSystemStore.h.

int oasys::FileSystemStore::default_perm_ [private]

Default permissions on database files.

Definition at line 78 of file FileSystemStore.h.

Referenced by get_table(), and init_database().

FdCache* oasys::FileSystemStore::fd_cache_ [private]

Definition at line 80 of file FileSystemStore.h.

Referenced by get_table(), and init().


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