|
reSIProcate/repro
9694
|
#include <ConfigStore.hxx>

Public Types | |
| typedef std::map< resip::Data, AbstractDb::ConfigRecord > | ConfigData |
Public Member Functions | |
| ConfigStore (AbstractDb &db) | |
| ~ConfigStore () | |
| bool | addDomain (const resip::Data &domain, const int tlsPort) |
| const ConfigData & | getConfigs () const |
| int | getTlsPort (const resip::Data &domain) |
| void | eraseDomain (const resip::Data &domain) |
Private Member Functions | |
| AbstractDb::Key | buildKey (const resip::Data &domain) const |
Private Attributes | |
| AbstractDb & | mDb |
| resip::RWMutex | mMutex |
| ConfigData | mCachedConfigData |
Definition at line 14 of file ConfigStore.hxx.
| typedef std::map<resip::Data,AbstractDb::ConfigRecord> repro::ConfigStore::ConfigData |
Definition at line 17 of file ConfigStore.hxx.
| ConfigStore::ConfigStore | ( | AbstractDb & | db | ) |
Definition at line 18 of file ConfigStore.cxx.
: mDb(db) { AbstractDb::ConfigRecordList input = mDb.getAllConfigs(); for (AbstractDb::ConfigRecordList::const_iterator it = input.begin(); it != input.end(); it++) { mCachedConfigData[it->mDomain] = *it; } }
| ConfigStore::~ConfigStore | ( | ) |
Definition at line 30 of file ConfigStore.cxx.
{
}
| bool ConfigStore::addDomain | ( | const resip::Data & | domain, |
| const int | tlsPort | ||
| ) |
Definition at line 36 of file ConfigStore.cxx.
{
InfoLog( << "Add domain " << domain << " to config." );
AbstractDb::ConfigRecord rec;
rec.mDomain = domain;
rec.mTlsPort = tlsPort;
if(!mDb.addConfig(buildKey(domain), rec))
{
return false;
}
{
Lock lock(mMutex, VOCAL_WRITELOCK);
mCachedConfigData[domain] = rec;
}
return true;
}
| AbstractDb::Key ConfigStore::buildKey | ( | const resip::Data & | domain | ) | const [private] |
Definition at line 94 of file ConfigStore.cxx.
{
return domain;
}
| void ConfigStore::eraseDomain | ( | const resip::Data & | domain | ) |
Definition at line 83 of file ConfigStore.cxx.
{
mDb.eraseConfig( buildKey(domain) );
{
Lock lock(mMutex, VOCAL_WRITELOCK);
mCachedConfigData.erase(domain);
}
}
| const ConfigStore::ConfigData & ConfigStore::getConfigs | ( | ) | const |
Definition at line 59 of file ConfigStore.cxx.
{
// LOCKING NOTE: From an API perspective this method dangerous, but we know that the WebAdmin Thread is currently
// the only thread requiring a WRITE lock and is the only thread calling this function, so
// locking is not required
return mCachedConfigData;
}
| int ConfigStore::getTlsPort | ( | const resip::Data & | domain | ) |
Definition at line 69 of file ConfigStore.cxx.
{
Lock lock(mMutex, VOCAL_READLOCK);
ConfigData::const_iterator it = mCachedConfigData.find(domain);
if(it != mCachedConfigData.end())
{
return it->second.mTlsPort;
}
return 0;
}
Definition at line 35 of file ConfigStore.hxx.
AbstractDb& repro::ConfigStore::mDb [private] |
Definition at line 31 of file ConfigStore.hxx.
resip::RWMutex repro::ConfigStore::mMutex [private] |
Definition at line 34 of file ConfigStore.hxx.
1.7.5.1