blob_id = 1;
106 for(
size_t i= 0;
i< test_set.size(); ++
i) {
109cout <<
"\nsize="<<
r.blob_size <<
" count="<<
r.count << endl;
111 for(;
r.count;
r.count--) {
116 if((
r.count % 10000) == 0) {
120cerr <<
"Elapsed = "<<
sw.
Elapsed() << endl;
127 env.SetLogInMemory(
true);
128 env.SetLogBSize(50 * 1024 * 1024);
129 env.SetCacheSize(400 * 1024 * 1024);
132vector<TestRec> test_set;
134vector<TestRec> test_set2(test_set);
136 if(test_set.size() == 0) {
137cout <<
"Empty test load."<< endl;
140cout <<
"Loaded "<< test_set.size() <<
" records."<< endl;
144split_store_hash.
Open(
"split_hash",
151cout <<
"Loading hash store."<< endl;
153cout <<
"Ok. elapsed="<<
sw.
Elapsed() << endl << endl;
158split_store_btree.
Open(
"split_btree",
164cout <<
"Loading btree store."<< endl;
166cout <<
"Ok. elapsed="<<
sw.
Elapsed() << endl << endl;
174cout <<
"Loading "<<
file_name<<
" ... "<< endl;
181 for(++
lr; !
lr.AtEOF(); ++
lr) {
183 stringcount_str, size_str;
196test_set.push_back(rec);
198cout <<
"Blank record: "<<
st<< endl;
201cout <<
"ok "<< endl;
217d->SetUsageContext(
"test_bdb_split",
218 "test BDB split storage");
229cout <<
"Run BDB split storage test"<< endl << endl;
231 char* buf_small =
new char[256];
232 char* buf_large =
new char[1024*1024];
233 char* buf_read =
new char[2*1024*1024];
234 void*
buf= buf_read;
236::strcpy(buf_small,
"test small 1");
237::strcpy(buf_large,
"test large 1");
246split_store.
Insert(2, buf_large, 1024 * 1024);
247split_store.
Insert(1, buf_small, 256);
249::strcpy(buf_small,
"test small 2");
250::strcpy(buf_large,
"test large 2");
260split_store.
Save();
272 intres =
strcmp(buf_read,
"test small 1");
278res =
strcmp(buf_read,
"test large 2");
285res =
strcmp((
const char*)&chbuf[0],
"test large 2");
294cout <<
"Error! DBD errno exception:"<< ex.what();
299cout <<
"Error! DBD library exception:"<< ex.what();
304cout <<
"TEST execution completed successfully!"<< endl << endl;
313 int main(
intargc,
const char* argv[])
BDB library BLOB support.
ICache interface implementation on top of Berkeley DB.
Berkeley BDB file cursor.
Wrapper around Berkeley DB environment structure.
Exception specifications for BDB library.
BDB File covertion into text.
BDB library split BLOB store.
Wrapper around Berkeley DB transaction structure.
Volume split BLOB demultiplexer.
BLOB storage based on single unsigned integer key Supports BLOB volumes and different base page size ...
BDB environment object a collection including support for some or all of caching, locking,...
BDB errno exception class.
void LoadTestSet(const string &file_name)
CBDB_BlobSplitStore< bm::bvector<> > TBlobSplitStore
void ReadTestSet(vector< TestRec > &test_set, const string &file_name)
void Init(void)
Initialize the application.
int Run(void)
Run the application.
void LoadSplitStore(vector< TestRec > &test_set, TBlobSplitStore &split_store)
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
Simple implementation of ILineReader for i(o)streams.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
EBDB_ErrCode Insert(unsigned id, const void *data, size_t size, unsigned *coord)
Insert BLOB into the storage.
void FreeUnusedMem()
Reclaim unused memory.
EBDB_ErrCode ReadRealloc(unsigned id, CBDB_RawFile::TBuffer &buffer)
Read BLOB into vector.
void SetVolumeCacheSize(unsigned int cache_size)
EBDB_ErrCode UpdateInsert(unsigned id, const void *data, size_t size, unsigned *coord)
Update or insert BLOB.
void Save(typename TDeMuxStore::ECompact compact_vectors=TDeMuxStore::eCompact)
Save storage dictionary (demux disposition).
EBDB_ErrCode Fetch(unsigned id, void **buf, size_t buf_size, CBDB_RawFile::EReallocMode allow_realloc, size_t *blob_size)
Fetch LOB record directly into the provided '*buf'.
void SetEnv(CBDB_Env &env)
Associate with the environment. Should be called before opening.
void GetIdVector(TBitVector *bv) const
Get all id of all BLOBs stored.
void Open(const string &storage_name, CBDB_RawFile::EOpenMode open_mode, CBDB_RawFile::EDBType db_type=CBDB_RawFile::eBtree)
Open storage (reads storage dictionary into memory)
EBDB_ErrCode
BDB Return codes.
@ eCreate
implies 'eReadWrite' too
@ eThreaded
corresponds to DB_THREAD
void SetDiagPostFlag(EDiagPostFlag flag)
Set the specified flag (globally).
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
void SetDiagTrace(EDiagTrace how, EDiagTrace dflt=eDT_Default)
Set the diagnostic trace settings.
@ eDPF_Trace
Default flags to use when tracing.
@ eDPF_File
File name (not full path)
@ eDT_Enable
Enable messages of severity "eDiag_Trace".
@ eDiag_Warning
Warning message.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ fAllowTrailingSpaces
Ignore trailing whitespace characters.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ fAllowLeadingSpaces
Ignore leading whitespace characters in converted string.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
@ eStart
Start timer immediately after creating.
Lightweight interface for getting lines of data with minimal memory copying.
int strcmp(const char *str1, const char *str2)
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
Defines: CTimeFormat - storage class for time format.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins lr(sljit_gpr dst, sljit_gpr src)
int main(int argc, const char *argv[])
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