fcount = buffer_man.
FieldCount();
78 for(
unsigned i= 0;
i< fcount; ++
i) {
94 size_tpos = matcher.
Search(str_buf, 0, str_buf_len);
103str_buf = tmp_str->c_str();
104str_buf_len = tmp_str->length();
181 template<
typenameT>
183 const T& param_value,
187<< setw(20) << param_name
189<< param_value << units);
197 const bool& param_value)
200<< setw(20) << param_name
202<< (param_value ?
"true":
"false"));
237 const string& section_name)
239unique_ptr<CBDB_Env>
env;
283path +
"/bdb_err.log");
285 if(!err_path.empty()) {
286 stringdir, base, ext;
294 stringcache_size_str;
310 stringlog_mem_size_str;
326 if(log_max < 1024 * 1024) {
327log_max = 1024 * 1024;
331 boollog_autoremove =
366 intmax_lock_objects =
377 intmp_maxwrite_sleep =
383 intcheckpoint_interval =
387 boolenable_checkpoint =
399 intmemp_trickle_percent =
410 env->OpenErrFile(err_path);
413 env->SetCacheSize(cache_size, cache_num);
416 env->SetLogInMemory(
true);
417 s_LogEnvParam(
"BDB log mem size (in-memory log)", log_mem_size);
418 env->SetLogBSize((
unsigned)log_mem_size);
421 if(!log_path.empty() && log_path != path) {
423 env->SetLogDir(log_path);
428 env->SetLogFileMax((
unsigned)log_max);
431 env->SetLogAutoRemove(log_autoremove);
435 env->SetDirectDB(direct_db);
436 env->SetDirectLog(direct_log);
441 env->SetLockTimeout(lock_timeout);
445 env->SetTasSpins(tas_spins);
449 env->SetMaxLocks(max_locks);
451 if(max_lock_objects) {
453 env->SetMaxLockObjects(max_lock_objects);
456 s_LogEnvParam(
"BDB mempool max write sleep", mp_maxwrite_sleep);
457 env->SetMpMaxWrite(mp_maxwrite, mp_maxwrite_sleep);
461 env->SetCheckPointKB(checkpoint_kb);
463 if(checkpoint_min) {
465 env->SetCheckPointMin(checkpoint_min);
467 env->EnableCheckPoint(enable_checkpoint);
472 env->OpenWithTrans(path,
476 env->OpenWithLocks(path);
479 env->OpenConcurrentDB(path);
486 if(
env->IsTransactional()) {
500 if(checkpoint_interval) {
501 s_LogEnvParam(
"BDB checkpoint interval (sec)", checkpoint_interval);
502 s_LogEnvParam(
"BDB trickle percent", memp_trickle_percent);
503 env->RunCheckpointThread(checkpoint_interval, memp_trickle_percent);
514 return env.release();
Wrapper around Berkeley DB environment structure.
static const char * kEnvParam_direct_db
static const char * kEnvParam_mp_maxwrite_sleep
static const char * kEnvParam_direct_log
static const char * kEnvParam_log_file_max
static const char * kEnvParam_max_lock_objects
static const char * BDB_GetStringFieldBuf(const CBDB_Field &fld)
Check if field is a variant of string, returns pointer on the internal buffer (or NULL).
static int BDB_find_field(const CBDB_BufferManager &buffer_man, const CBoyerMooreMatcher &matcher, string *tmp_str)
Search for value in the field buffer.
static const char * kEnvParam_path
static const char * kEnvParam_log_autoremove
static const char * kEnvParam_reinit
static const char * kEnvParam_TAS_spins
static const char * kEnvParam_type
static const char * kEnvParam_errfile
static const char * kEnvParam_checkpoint_kb
static const char * kEnvParam_transaction_log_path
static const char * kEnvParam_write_sync
static const char * kEnvParam_lock_timeout
static const char * kEnvParam_memp_trickle_percent
static const char * kEnvParam_cache_size
static const char * kEnvParam_mp_maxwrite
static const char * kEnvParam_mem_size
static const char * kEnvParam_cache_num
static const char * kEnvParam_max_locks
static const char * kEnvParam_enable_checkpoint
static const char * kEnvParam_log_mem_size
static const char * kEnvParam_checkpoint_min
static const char * kEnvParam_checkpoint_interval
void s_LogEnvParam(const string ¶m_name, const T ¶m_value, const string &units=kEmptyStr)
Log a parameter in a human-readable format.
BDB Data Field Buffer manager class.
BDB environment object a collection including support for some or all of caching, locking,...
BDB errno exception class.
Length prefised string field type.
String field type designed to work with C-strings (ASCIIZ)
Base class for constructing BDB fields.
This implemetation uses the Boyer-Moore alg.
CBDB_File::TUnifiedFieldIndex BDB_GetUFieldIdx(int fidx, bool key)
Make field index in CBDB_File format.
int TUnifiedFieldIndex
CBDB_File keeps data in two buffers (key buffer and data buffer).
const CBDB_BufferManager * GetKeyBuffer() const
Get Buffer manager for key section of the file.
const CBDB_BufferManager * GetDataBuffer() const
Get Buffer manager for data section of the file.
bool IsNull() const
Return TRUE if field is NULL.
unsigned int FieldCount() const
Return number of fields attached using function Bind.
virtual size_t GetDataLength(const void *buf) const =0
Return current effective size of the buffer.
const CBDB_Field & GetField(unsigned int idx) const
virtual void ToString(string &str) const =0
const void * GetBuffer() const
Get pointer to the data. NULL if not yet attached.
int BDB_get_rowid(const CBDB_File &dbf)
Return record id (integer key)
CBDB_Env * BDB_CreateEnv(const CNcbiRegistry ®, const string §ion_name)
Create and configure BDB environment using CNcbiRegistry as a parameter container.
void BDB_RecoverEnv(const string &path, bool fatal_recover)
Run Berkeley DB recovery in private environment.
EEnvType
Environment types.
bool IsRecovery() const
If it is DB_RUNRECOVERY error.
@ eTransASync
Non-durable asyncronous transaction.
@ eTransSync
Syncronous transaction.
@ eRunRecovery
Run DB recovery first.
@ eThreaded
corresponds to DB_THREAD
@ eDeadLock_Default
Default deadlock detector.
#define LOG_POST_X(err_subcode, message)
void Info(CExceptionArgs_Base &args)
static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)
Assemble a path from basic components.
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
virtual bool Exists(void) const
Check if directory "dirname" exists.
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Delete existing directory.
static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)
Split a path string into its basic components.
uint64_t Uint8
8-byte (64-bit) unsigned integer
virtual bool GetBool(const string §ion, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
virtual int GetInt(const string §ion, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
virtual bool HasEntry(const string §ion, const string &name=kEmptyStr, TFlags flags=0) const
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
@ eReturn
Return default value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
size_t Search(const string &text, size_t pos=0) const
Search for the pattern over text starting at position pos.
static Uint8 StringToUInt8_DataSize(const CTempString str, TStringToNumFlags flags=0)
Convert string that can contain "software" qualifiers to Uint8.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static string & ToLower(string &str)
Convert string to lower case â string& version.
@ fConvErr_NoThrow
Do not throw an exception on error.
Definition of all error codes used in bdb library (bdb.lib and ncbi_xcache_bdb.lib).
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4