1 #ifndef LOG___BDB_SPLIT_CURSOR__HPP
2 #define LOG___BDB_SPLIT_CURSOR__HPP
47 template <
typename BDB_SplitStore,
typename BDB_Vol =
typename BDB_SplitStore::TBlobFile>
53 bool operator() (
const string& s1,
const string& s2)
const
55 string::size_type pos1 = s1.find_last_of(
"_");
56 if (pos1 == string::npos) {
59 string::size_type pos2 = s2.find_last_of(
"_");
60 if (pos2 == string::npos) {
104 template <
typename BDB_SplitStore,
typename BDB_Vol>
108 , m_BufferSize(40 * 1024 * 1024)
117 vector<string> paths;
118 vector<string> masks;
120 string path = store.GetFileName();
125 path_base += path_ext;
139 paths.push_back(path);
140 masks.push_back(path_base +
"_*");
142 paths.begin(), paths.end(), masks.begin(), masks.end(),
148 "found " <<
m_Files.size() <<
" candidate files");
153 template <
typename BDB_SplitStore,
typename BDB_Vol>
158 if ( !m_Cursor.get() || m_Cursor->Fetch() !=
eBDB_Ok) {
160 if ( !m_Cursor.get() ) {
172 template <
typename BDB_SplitStore,
typename BDB_Vol>
180 template <
typename BDB_SplitStore,
typename BDB_Vol>
184 if (m_Cursor.get()) {
185 return m_Cursor->GetLastMultiFetchData();
191 template <
typename BDB_SplitStore,
typename BDB_Vol>
195 if (m_Cursor.get()) {
196 return m_Cursor->GetLastMultiFetchDataLen();
202 template <
typename BDB_SplitStore,
typename BDB_Vol>
206 if (m_Volume.get()) {
213 template <
typename BDB_SplitStore,
typename BDB_Vol>
217 return GetLastBlobId();
221 template <
typename BDB_SplitStore,
typename BDB_Vol>
225 if (m_Volume.get()) {
226 return (
Uint4)m_Volume->GetUid();
232 template <
typename BDB_SplitStore,
typename BDB_Vol>
239 if ( !m_Files.size() ) {
244 string path = m_Files.back();
248 m_Volume->SetCacheSize(10 * 1024 * 1024);
250 m_Volume->SetEnv(*m_Env);
254 <<
"CBDB_SplitCursor::x_NextVolume(): opening: " << path);
258 m_Cursor->InitMultiFetch(m_BufferSize);
Berkeley BDB file cursor.
Wrapper around Berkeley DB environment structure.
BDB environment object a collection including support for some or all of caching, locking,...
Berkeley DB file cursor class.
unique_ptr< CBDB_FileCursor > m_Cursor
BDB_SplitStore TSplitStore
size_t GetLastMultiFetchDataLen() const
TVolume & GetSourceVolume()
Uint4 GetLastBlobId() const
unique_ptr< TVolume > m_Volume
Uint4 GetCurrentBlobId() const
const void * GetLastMultiFetchData() const
CBDB_SplitCursor(TSplitStore &store)
void InitMultiFetch(size_t buffer_size)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Include a standard set of the NCBI C++ Toolkit most basic headers.
EBDB_ErrCode
BDB Return codes.
const string & GetPath() const
return the path to the environment
DB_ENV * GetEnv()
Return underlying DB_ENV structure pointer for low level access.
#define LOG_POST_XX(error_name, err_subcode, message)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Info(CExceptionArgs_Base &args)
static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)
Get an absolute path from some, possibly relative, path.
static bool IsAbsolutePath(const string &path)
Check if a "path" is absolute for the current OS.
void FindFiles(TPathIterator path_begin, TPathIterator path_end, const vector< string > &masks, TFindFunc &find_func, TFindFiles flags=fFF_Default)
Generic algorithm for file search.
static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)
Split a path string into its basic components.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void Start(void)
Start the timer.
Definition of all error codes used in bdb library (bdb.lib and ncbi_xcache_bdb.lib).
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
bool operator()(const string &s1, const string &s2) const