#include <FileSystemStore.h>
Inheritance diagram for oasys::FileSystemStore:
NEW: Now with a level of indirection!
Definition at line 68 of file FileSystemStore.h.
Public Member Functions | |
FileSystemStore (const char *logpath) | |
FileSystemStore & | operator= (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 | |
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. | |
FdCache * | fd_cache_ |
Friends | |
class | FileSystemTable |
typedef oasys::OpenFdCache<std::string> oasys::FileSystemStore::FdCache [private] |
Definition at line 71 of file FileSystemStore.h.
oasys::FileSystemStore::FileSystemStore | ( | const char * | logpath | ) |
Definition at line 59 of file FileSystemStore.cc.
oasys::FileSystemStore::FileSystemStore | ( | const FileSystemStore & | ) |
oasys::FileSystemStore::~FileSystemStore | ( | ) |
Definition at line 68 of file FileSystemStore.cc.
FileSystemStore& oasys::FileSystemStore::operator= | ( | const FileSystemStore & | ) |
int oasys::FileSystemStore::init | ( | const StorageConfig & | cfg | ) | [virtual] |
virtual from DurableStoreImpl
Implements oasys::DurableStoreImpl.
Definition at line 73 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 136 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 185 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 209 of file FileSystemStore.cc.
References oasys::DS_ERR, log_err, and tables_dir_.
int oasys::FileSystemStore::check_database | ( | ) | [private] |
Check for the existance of databases.
-2 if the database file doesn't exist. Otherwise -1.
Definition at line 232 of file FileSystemStore.cc.
References errno, and tables_dir_.
Referenced by init().
int oasys::FileSystemStore::init_database | ( | ) | [private] |
Create the database.
Definition at line 249 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.
Definition at line 270 of file FileSystemStore.cc.
References ASSERT, db_dir_, and log_notice.
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.
friend class FileSystemTable [friend] |
bool oasys::FileSystemStore::init_ [private] |
Definition at line 93 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 94 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 95 of file FileSystemStore.h.
Referenced by check_database(), del_table(), get_table(), get_table_names(), init(), and init_database().
Definition at line 97 of file FileSystemStore.h.
int oasys::FileSystemStore::default_perm_ [private] |
Default permissions on database files.
Definition at line 98 of file FileSystemStore.h.
Referenced by get_table(), and init_database().
FdCache* oasys::FileSystemStore::fd_cache_ [private] |