NCBI C++ ToolKit
bdb_merge.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef BDB_BLOB_MERGE_HPP_
2 #define BDB_BLOB_MERGE_HPP_
3 
4 /* $Id: bdb_merge.hpp 77790 2017-05-08 13:31:07Z ivanov $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Anatoliy Kuznetsov, Mike DiCuccio
30  *
31  * File Description: BDB compatible volume merge components
32  *
33  */
34 
35 #include <corelib/ncbimtx.hpp>
37 #include <db/bdb/bdb_blob.hpp>
38 #include <db/bdb/bdb_cursor.hpp>
39 #include <util/thread_nonstop.hpp>
40 
41 
42 
44 
45 /** @addtogroup BDB_BLOB
46  *
47  * @{
48  */
49 
50 
51 /// Generic iterator to traverse any CBDB_BLobFile for volume merge
52 /// BF - any CBDB_BLobFile derived class
53 ///
54 template<class BF>
56 {
57 public:
58  typedef BF TBlobFile;
59 
60 public:
63  size_t fetch_buffer_size = 10 * 1024 * 1024);
64  virtual ~CBDB_MergeBlobWalker();
65 
66  virtual IAsyncInterface* QueryIAsync() { return 0; }
67  virtual bool IsEof() const { return m_Eof; }
68  virtual bool IsGood() const { return true; }
69  virtual void FetchFirst();
70  virtual void Fetch();
71  virtual const unsigned char* GetKeyPtr() const { return m_KeyPtr; }
72  virtual Uint4 GetUint4Key() const { return m_Key; }
73  virtual const unsigned char* GetBufferPtr(size_t* buf_size) const
74  {
75  if (buf_size) {
76  *buf_size = m_DataLen;
77  }
78  return (unsigned char*)m_Data;
79  }
80  virtual void Close() { m_Cursor.reset(0); }
81  virtual void SetRecordMoved() {}
82 
83 protected:
85  unique_ptr<CBDB_FileCursor> m_Cursor;
87  bool m_Eof;
88  const void* m_Data;
89  size_t m_DataLen;
91  const unsigned char* m_KeyPtr;
92 };
93 
94 
95 /// Generic iterator to traverse any CBDB_BLobFile for volume merge
96 /// BF - any CBDB_BLobFile derived class
97 /// This implementation supports asyncronous processing.
98 template<class BF>
100 {
101 public:
102  typedef BF TBlobFile;
103 
104 public:
106  TBlobFile* blob_file,
108  size_t fetch_buffer_size = 10 * 1024 * 1024);
109  virtual ~CBDB_MergeBlobWalkerAsync();
110 
111  virtual IAsyncInterface* QueryIAsync() { return &m_AsyncImpl; }
112  virtual bool IsEof() const;
113  virtual bool IsGood() const;
114  virtual void FetchFirst();
115  virtual void Fetch();
116  virtual const unsigned char* GetKeyPtr() const;
117  virtual Uint4 GetUint4Key() const;
118  virtual const unsigned char* GetBufferPtr(size_t* buf_size) const;
119  virtual void Close();
120  virtual void SetRecordMoved() {}
121 
122 protected:
124 
125  /// IAsync implementation
126  /// @internal
127  class CAsync : public IAsyncInterface
128  {
129  public:
131  virtual EStatus GetStatus() const
132  {
134  if (!m_Impl.m_Good)
135  return eFailed;
136  if (m_Impl.m_Data)
137  return eReady;
138  return eNotReady;
139  }
140  virtual EStatus WaitReady() const
141  {
142  while (1) {
143  EStatus st = GetStatus();
144  switch (st)
145  {
146  case eReady: return st;
147  case eNotReady: break;
148  default: return st;
149  }
150  }
151  }
152  private:
154  };
155  /// Background thread class (executes async requests)
156  /// @internal
157  class CJobThread : public CThreadNonStop
158  {
159  public:
161  : CThreadNonStop(1000), m_Impl(impl)
162  {}
163  protected:
164  /// Do job delegated processing to the main class
165  virtual void DoJob(void) { m_Impl.DoFetch(); }
166  protected:
168  };
169  friend class TMainClass::CAsync;
171 protected:
172  void DoFetch();
173 protected:
176  unique_ptr<CBDB_FileCursor> m_Cursor;
178  bool m_Eof;
179  bool m_Good;
180  const void* m_Data;
181  size_t m_DataLen;
183  const unsigned char* m_KeyPtr;
186 };
187 
188 
189 
190 /// Merge store saves result to BLOB store
191 ///
192 template<class BStore>
194 {
195 public:
196  typedef BStore TBlobStore;
197 public:
198  CBDB_MergeStore(TBlobStore* blob_store,
200  virtual ~CBDB_MergeStore();
201 
202  virtual IAsyncInterface* QueryIAsync() { return 0; }
203  virtual bool IsGood() const { return true; }
204  virtual void Store(Uint4 blob_id, CMergeVolumes::TRawBuffer* buffer);
205  virtual void Close() {}
206  virtual CMergeVolumes::TRawBuffer* ReadBlob(Uint4 blob_id);
207 private:
209 };
210 
211 
212 /// Merge store saves result to BLOB store.
213 /// This is asyncronous implementation, it starts a background thread
214 /// to process requests.
215 ///
216 template<class BStore>
218 {
219 public:
220  typedef BStore TBlobStore;
221 public:
222  CBDB_MergeStoreAsync(TBlobStore* blob_store,
224  virtual ~CBDB_MergeStoreAsync();
225 
226  virtual IAsyncInterface* QueryIAsync() { return &m_AsyncImpl; }
227  virtual bool IsGood() const;
228  virtual void Store(Uint4 blob_id, CMergeVolumes::TRawBuffer* buffer);
229  virtual void Close();
230  virtual CMergeVolumes::TRawBuffer* ReadBlob(Uint4 blob_id);
231 protected:
232  void DoStore();
233 protected:
235 
236  /// IAsync implementation
237  /// @internal
238  class CAsync : public IAsyncInterface
239  {
240  public:
242  virtual EStatus GetStatus() const
243  {
245  if (!m_Impl.m_Good)
246  return eFailed;
247  if (m_Impl.m_Request_Buffer == 0)
248  return eReady;
249  return eNotReady;
250  }
251  virtual EStatus WaitReady() const
252  {
253  while (1) {
254  EStatus st = GetStatus();
255  switch (st)
256  {
257  case eReady: return st;
258  case eNotReady: break;
259  default: return st;
260  }
261  }
262  }
263  private:
265  };
266  /// Background thread class (executes async requests)
267  /// @internal
268  class CJobThread : public CThreadNonStop
269  {
270  public:
272  : CThreadNonStop(1000), m_Impl(impl)
273  {}
274  protected:
275  /// Do job delegated processing to the main class
276  virtual void DoJob(void) { m_Impl.DoStore(); }
277  protected:
279  };
280  friend class TMainClass::CAsync;
282 protected:
284  bool m_Good;
290 };
291 
292 
293 
294  /* @} */
295 
296  /////////////////////////////////////////////////////////////////////////////
297 // IMPLEMENTATION of INLINE functions
298 /////////////////////////////////////////////////////////////////////////////
299 
300 template<class BF>
302  EOwnership own,
303  size_t fetch_buffer_size)
304  : m_BlobFile(blob_file, own),
305  m_FetchBufferSize(fetch_buffer_size),
306  m_Eof(false)
307 {
308 }
309 
310 template<class BF>
312 {
313 }
314 
315 template<class BF>
317 {
318  m_Cursor.reset(new CBDB_FileCursor(*m_BlobFile));
319  m_Cursor->SetCondition(CBDB_FileCursor::eGE);
320  if (m_FetchBufferSize) {
321  m_Cursor->InitMultiFetch(m_FetchBufferSize);
322  }
323  this->Fetch();
324 }
325 
326 template<class BF>
328 {
329  EBDB_ErrCode err = m_Cursor->Fetch();
330  switch (err)
331  {
332  case eBDB_Ok:
333  m_Data = m_Cursor->GetLastMultiFetchData();
334  m_DataLen = m_Cursor->GetLastMultiFetchDataLen();
335  _ASSERT(m_Data && m_DataLen);
336  {
337  const CBDB_BufferManager* key_bm = m_BlobFile->GetKeyBuffer();
338  const CBDB_Field& fld = key_bm->GetField(0);
339  const void* ptr = fld.GetBuffer();
340  m_KeyPtr =(const unsigned char*) ptr;
341  m_Key = fld.GetUint();
342  }
343  break;
344  case eBDB_NotFound:
345  m_Data = 0;
346  m_DataLen = 0;
347  m_Eof = true;
348  break;
349  default:
350  _ASSERT(0);
351  };
352 }
353 
354 /////////////////////////////////////////////////////////////////////////////
355 
356 template<class BStore>
358  EOwnership own)
359  : m_BlobStore(blob_store, own)
360 {
361 }
362 
363 template<class BStore>
365 {
366 }
367 
368 template<class BStore>
371 {
372  CMergeVolumes::TBufPoolGuard guard(*(this->m_BufResourcePool), buffer);
373  EBDB_ErrCode err = m_BlobStore->Insert(
374  blob_id,
375  &((*buffer)[0]), buffer->size());
376 }
377 
378 template<class BStore>
380 {
381  CMergeVolumes::TRawBuffer* buf = m_BufResourcePool->Get();
382  CMergeVolumes::TBufPoolGuard buf_guard(*m_BufResourcePool, buf);
383  EBDB_ErrCode ret = m_BlobStore->ReadRealloc(blob_id, buf);
384  if (ret == eBDB_Ok) {
385  return buf_guard.Release();
386  }
387  return 0;
388 }
389 
390 /////////////////////////////////////////////////////////////////////////////
391 
392 
393 template<class BStore>
395  EOwnership own)
396  : m_Good(true),
397  m_BlobStore(blob_store, own),
398  m_Request_BlobId(0),
399  m_Request_Buffer(0),
400  m_AsyncImpl(*this)
401 {
402  m_JobThread.Reset(new CJobThread(*this));
403  m_JobThread->Run();
404 }
405 
406 template<class BStore>
408 {
409 }
410 
411 template<class BStore>
413 {
414  while (1) {
415  {{
416  CFastMutex::TWriteLockGuard guard(m_Lock);
417  if (m_Request_Buffer == 0) { // make sure the last request is done
418  m_JobThread->RequestStop();
419  m_JobThread->Join();
420  break;
421  }
422  }}
423  }
424 }
425 
426 template<class BStore>
428 {
429  CFastMutex::TReadLockGuard guard(m_Lock);
430  return m_Good;
431 }
432 
433 template<class BStore>
436 {
437  CFastMutex::TWriteLockGuard guard(m_Lock);
438  if (m_Request_Buffer) {
439  NCBI_THROW(CMerge_Exception, eOperationNotReady, "Store not ready.");
440  }
441  m_Request_BlobId = blob_id;
442  m_Request_Buffer = buffer;
443  m_JobThread->RequestDoJob();
444 }
445 
446 template<class BStore>
448 {
450  guard(*(this->m_BufResourcePool), m_Request_Buffer);
451 
452  CFastMutex::TWriteLockGuard lock(m_Lock);
453  if (!m_Request_Buffer) {
454  return;
455  }
456  try {
457  EBDB_ErrCode err = m_BlobStore->Insert(
458  m_Request_BlobId,
459  &((*m_Request_Buffer)[0]),
460  m_Request_Buffer->size());
461  if (err != eBDB_Ok) {
462  m_Good = false;
463  }
464  m_Request_Buffer = 0;
465  } catch (...) {
466  m_Good = false;
467  throw;
468  }
469 }
470 
471 
472 template<class BStore>
474 {
475  CMergeVolumes::TRawBuffer* buf = m_BufResourcePool->Get();
476  CMergeVolumes::TBufPoolGuard buf_guard(*m_BufResourcePool, buf);
477  {{
478  CFastMutex::TWriteLockGuard guard(m_Lock);
479  EBDB_ErrCode ret = m_BlobStore->ReadRealloc(blob_id, *buf);
480  if (ret == eBDB_Ok) {
481  return buf_guard.Release();
482  }
483  }}
484  return 0;
485 }
486 
487 /////////////////////////////////////////////////////////////////////////////
488 
489 template<class BF>
491  TBlobFile* blob_file,
492  EOwnership own,
493  size_t fetch_buffer_size)
494  : m_BlobFile(blob_file, own),
495  m_FetchBufferSize(fetch_buffer_size),
496  m_Eof(false),
497  m_Good(true),
498  m_AsyncImpl(*this)
499 {
500  m_JobThread.Reset(new CJobThread(*this));
501  m_JobThread->Run();
502 }
503 
504 template<class BF>
506 {
507 }
508 
509 template<class BF>
511 {
512  CFastMutex::TReadLockGuard lock(m_Lock);
513  return m_Eof;
514 }
515 
516 template<class BF>
518 {
519  CFastMutex::TReadLockGuard lock(m_Lock);
520  return m_Good;
521 }
522 
523 template<class BF>
525 {
526  CFastMutex::TWriteLockGuard lock(m_Lock);
527 
528  m_Cursor.reset(new CBDB_FileCursor(*m_BlobFile));
529  m_Cursor->SetCondition(CBDB_FileCursor::eGE);
530  if (m_FetchBufferSize) {
531  m_Cursor->InitMultiFetch(m_FetchBufferSize,
533  }
534  m_Key = 0;
535  m_KeyPtr = 0;
536  m_DataLen = 0;
537  m_Data = 0;
538 
539  m_JobThread->RequestDoJob();
540 }
541 
542 template<class BF>
544 {
545  CFastMutex::TWriteLockGuard lock(m_Lock);
546 
547  // here we try to move to the next multifetch buffer record
548  // without delegating to background thread
549  // if Fetch returns error code, indicating we are at the end of
550  // the multifetch buffer we delegate next fetch call to the
551  // background reader (next call will be slow read from the disk)
552  //
553  // so here we have hybrid mode, when fast fetch is done in the same call
554  // and potentially slow one is in the background
555  //
556  EBDB_ErrCode err = m_Cursor->Fetch();
557  switch (err)
558  {
559  case eBDB_Ok:
560  m_Data = m_Cursor->GetLastMultiFetchData();
561  m_DataLen = m_Cursor->GetLastMultiFetchDataLen();
562  {
563  const CBDB_BufferManager* key_bm = m_BlobFile->GetKeyBuffer();
564  const CBDB_Field& fld = key_bm->GetField(0);
565  const void* ptr = fld.GetBuffer();
566  m_KeyPtr =(const unsigned char*) ptr;
567  m_Key = fld.GetUint();
568  }
569  break;
570  case eBDB_NotFound:
571  m_Data = 0;
572  m_DataLen = 0;
573  m_Eof = true;
574  break;
575  case eBDB_MultiRowEnd:
576  m_Key = 0;
577  m_KeyPtr = 0;
578  m_DataLen = 0;
579  m_Data = 0;
580 
581  m_JobThread->RequestDoJob();
582  break;
583  default:
584  _ASSERT(0);
585  };
586 
587 }
588 
589 template<class BF>
591 {
592  CFastMutex::TWriteLockGuard lock(m_Lock);
593  if (m_Data || !m_Cursor.get()) { // fetch was not requested...
594  return;
595  }
596  try {
597  bool re_try;
598  do {
599  re_try = false;
600 
601  EBDB_ErrCode err = m_Cursor->Fetch();
602  switch (err)
603  {
604  case eBDB_Ok:
605  m_Data = m_Cursor->GetLastMultiFetchData();
606  m_DataLen = m_Cursor->GetLastMultiFetchDataLen();
607  {
608  const CBDB_BufferManager* key_bm = m_BlobFile->GetKeyBuffer();
609  const CBDB_Field& fld = key_bm->GetField(0);
610  const void* ptr = fld.GetBuffer();
611  m_KeyPtr =(const unsigned char*) ptr;
612  m_Key = fld.GetUint();
613  }
614  break;
615  case eBDB_NotFound:
616  m_Data = 0;
617  m_DataLen = 0;
618  m_Eof = true;
619  break;
620  case eBDB_MultiRowEnd:
621  re_try = true;
622  break;
623  default:
624  _ASSERT(0);
625  };
626  } while (re_try);
627 
628  } catch (...) {
629  m_Good = false;
630  throw;
631  }
632 }
633 
634 
635 template<class BF>
636 const unsigned char* CBDB_MergeBlobWalkerAsync<BF>::GetKeyPtr() const
637 {
638  CFastMutex::TReadLockGuard lock(m_Lock);
639  return m_KeyPtr;
640 }
641 
642 template<class BF>
644 {
645  CFastMutex::TReadLockGuard lock(m_Lock);
646  return m_Key;
647 }
648 
649 template<class BF>
650 const unsigned char*
652 {
653  CFastMutex::TReadLockGuard lock(m_Lock);
654  if (buf_size) {
655  *buf_size = m_DataLen;
656  }
657  return (unsigned char*)m_Data;
658 }
659 
660 template<class BF>
662 {
663  m_JobThread->RequestStop();
664  m_JobThread->Join();
665  {{
666  CFastMutex::TWriteLockGuard lock(m_Lock);
667  m_Cursor.reset(0);
668  }}
669 }
670 
672 
673 #endif /* BDB_BLOB_MERGE_HPP_ */
BDB library BLOB support.
Berkeley BDB file cursor.
BDB Data Field Buffer manager class.
Definition: bdb_types.hpp:1768
Base class for constructing BDB fields.
Definition: bdb_types.hpp:297
Berkeley DB file cursor class.
Definition: bdb_cursor.hpp:95
IAsync implementation.
Definition: bdb_merge.hpp:128
Background thread class (executes async requests)
Definition: bdb_merge.hpp:158
Generic iterator to traverse any CBDB_BLobFile for volume merge BF - any CBDB_BLobFile derived class ...
Definition: bdb_merge.hpp:100
Generic iterator to traverse any CBDB_BLobFile for volume merge BF - any CBDB_BLobFile derived class.
Definition: bdb_merge.hpp:56
IAsync implementation.
Definition: bdb_merge.hpp:239
Background thread class (executes async requests)
Definition: bdb_merge.hpp:269
Merge store saves result to BLOB store.
Definition: bdb_merge.hpp:218
Merge store saves result to BLOB store.
Definition: bdb_merge.hpp:194
CFastMutex –.
Definition: ncbimtx.hpp:667
Base Merge algorithms exception class.
CRef –.
Definition: ncbiobj.hpp:618
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
Adaptation of CThread class repeatedly running some job.
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
@ eTakeOwnership
An object can take ownership of another.
Definition: ncbi_types.h:136
CBDB_MergeStore(TBlobStore *blob_store, EOwnership own=eTakeOwnership)
Definition: bdb_merge.hpp:357
const unsigned char * m_KeyPtr
Definition: bdb_merge.hpp:91
virtual void SetRecordMoved()
Signals that current record moved to merged storage (volume manager may decide to delete it later) Vo...
Definition: bdb_merge.hpp:81
CBDB_MergeBlobWalker(TBlobFile *blob_file, EOwnership own=eTakeOwnership, size_t fetch_buffer_size=10 *1024 *1024)
Definition: bdb_merge.hpp:301
virtual IAsyncInterface * QueryIAsync()
Get pointer to async.
Definition: bdb_merge.hpp:226
virtual CMergeVolumes::TRawBuffer * ReadBlob(Uint4 blob_id)
Read buffer with the specified blob_id This method is for store update, when we are merging into an e...
Definition: bdb_merge.hpp:379
virtual void Store(Uint4 blob_id, CMergeVolumes::TRawBuffer *buffer)
Store BLOB request This request can be asyncronous caller needs to check status using IAsyncInterface...
Definition: bdb_merge.hpp:369
virtual EStatus WaitReady() const
Wait until interface is ready (or operation fails) (On failure volume is free to throw an exception)
Definition: bdb_merge.hpp:140
AutoPtr< TBlobFile > m_BlobFile
Definition: bdb_merge.hpp:175
virtual void DoJob(void)
Do job delegated processing to the main class.
Definition: bdb_merge.hpp:276
virtual const unsigned char * GetBufferPtr(size_t *buf_size) const
Get low level access to the merge BLOB buffer and buffer size (next Fetch call invalidates this point...
Definition: bdb_merge.hpp:73
CMergeVolumes::TRawBuffer * m_Request_Buffer
Definition: bdb_merge.hpp:288
virtual IAsyncInterface * QueryIAsync()
Get pointer to async.
Definition: bdb_merge.hpp:66
virtual void Fetch()
Request to get next record This request can be asyncronous caller needs to check status using IAsyncI...
Definition: bdb_merge.hpp:543
virtual void FetchFirst()
Request to start fetching data This request can be asyncronous caller needs to check status using IAs...
Definition: bdb_merge.hpp:524
virtual bool IsGood() const
Return TRUE if storage device is in good shape.
Definition: bdb_merge.hpp:203
AutoPtr< TBlobStore > m_BlobStore
Definition: bdb_merge.hpp:208
virtual IAsyncInterface * QueryIAsync()
Get pointer to async.
Definition: bdb_merge.hpp:202
unique_ptr< CBDB_FileCursor > m_Cursor
Definition: bdb_merge.hpp:176
CBDB_MergeStoreAsync(TBlobStore *blob_store, EOwnership own=eTakeOwnership)
Definition: bdb_merge.hpp:394
virtual void SetRecordMoved()
Signals that current record moved to merged storage (volume manager may decide to delete it later) Vo...
Definition: bdb_merge.hpp:120
CBDB_MergeBlobWalkerAsync< BF > TMainClass
Definition: bdb_merge.hpp:123
virtual bool IsGood() const
Return TRUE if volume is in good condition (not failed)
Definition: bdb_merge.hpp:68
virtual EStatus GetStatus() const
Get current interface async. status.
Definition: bdb_merge.hpp:242
virtual bool IsEof() const
Return TRUE when volume traverse reaches the end.
Definition: bdb_merge.hpp:510
virtual const unsigned char * GetKeyPtr() const
Get low level access to the current key buffer.
Definition: bdb_merge.hpp:636
AutoPtr< TBlobStore > m_BlobStore
Definition: bdb_merge.hpp:285
virtual CMergeVolumes::TRawBuffer * ReadBlob(Uint4 blob_id)
Read buffer with the specified blob_id This method is for store update, when we are merging into an e...
Definition: bdb_merge.hpp:473
virtual ~CBDB_MergeBlobWalker()
Definition: bdb_merge.hpp:311
virtual ~CBDB_MergeStoreAsync()
Definition: bdb_merge.hpp:407
virtual ~CBDB_MergeBlobWalkerAsync()
Definition: bdb_merge.hpp:505
virtual void DoJob(void)
Do job delegated processing to the main class.
Definition: bdb_merge.hpp:165
virtual bool IsGood() const
Return TRUE if volume is in good condition (not failed)
Definition: bdb_merge.hpp:517
virtual EStatus WaitReady() const
Wait until interface is ready (or operation fails) (On failure volume is free to throw an exception)
Definition: bdb_merge.hpp:251
virtual void Fetch()
Request to get next record This request can be asyncronous caller needs to check status using IAsyncI...
Definition: bdb_merge.hpp:327
CAsync(TMainClass &impl)
Definition: bdb_merge.hpp:241
virtual void Close()
Close volume (when it ends) Method is responsible for finalization of merge procedure (it could be de...
Definition: bdb_merge.hpp:80
CRef< CJobThread > m_JobThread
Definition: bdb_merge.hpp:286
virtual bool IsGood() const
Return TRUE if storage device is in good shape.
Definition: bdb_merge.hpp:427
virtual void Close()
Close storage (when it ends) Method is responsible for finalization of store procedure,...
Definition: bdb_merge.hpp:412
virtual EStatus GetStatus() const
Get current interface async. status.
Definition: bdb_merge.hpp:131
unique_ptr< CBDB_FileCursor > m_Cursor
Definition: bdb_merge.hpp:85
virtual Uint4 GetUint4Key() const
Get access to the key as unsigned integer (if this type is supported)
Definition: bdb_merge.hpp:643
virtual Uint4 GetUint4Key() const
Get access to the key as unsigned integer (if this type is supported)
Definition: bdb_merge.hpp:72
const unsigned char * m_KeyPtr
Definition: bdb_merge.hpp:183
const void * m_Data
Definition: bdb_merge.hpp:88
CBDB_MergeBlobWalkerAsync(TBlobFile *blob_file, EOwnership own=eTakeOwnership, size_t fetch_buffer_size=10 *1024 *1024)
Definition: bdb_merge.hpp:490
virtual void Close()
Close storage (when it ends) Method is responsible for finalization of store procedure,...
Definition: bdb_merge.hpp:205
virtual const unsigned char * GetBufferPtr(size_t *buf_size) const
Get low level access to the merge BLOB buffer and buffer size (next Fetch call invalidates this point...
Definition: bdb_merge.hpp:651
virtual void FetchFirst()
Request to start fetching data This request can be asyncronous caller needs to check status using IAs...
Definition: bdb_merge.hpp:316
virtual const unsigned char * GetKeyPtr() const
Get low level access to the current key buffer.
Definition: bdb_merge.hpp:71
AutoPtr< TBlobFile > m_BlobFile
Definition: bdb_merge.hpp:84
virtual void Close()
Close volume (when it ends) Method is responsible for finalization of merge procedure (it could be de...
Definition: bdb_merge.hpp:661
CBDB_MergeStoreAsync< BStore > TMainClass
Definition: bdb_merge.hpp:234
virtual void Store(Uint4 blob_id, CMergeVolumes::TRawBuffer *buffer)
Store BLOB request This request can be asyncronous caller needs to check status using IAsyncInterface...
Definition: bdb_merge.hpp:434
virtual IAsyncInterface * QueryIAsync()
Get pointer to async.
Definition: bdb_merge.hpp:111
virtual ~CBDB_MergeStore()
Definition: bdb_merge.hpp:364
virtual bool IsEof() const
Return TRUE when volume traverse reaches the end.
Definition: bdb_merge.hpp:67
CRef< CJobThread > m_JobThread
Definition: bdb_merge.hpp:184
EBDB_ErrCode
BDB Return codes.
Definition: bdb_file.hpp:57
@ eBDB_MultiRowEnd
Definition: bdb_file.hpp:62
@ eBDB_Ok
Definition: bdb_file.hpp:58
@ eBDB_NotFound
Definition: bdb_file.hpp:59
virtual unsigned GetUint() const
Definition: bdb_types.hpp:261
const CBDB_Field & GetField(unsigned int idx) const
Definition: bdb_types.hpp:2517
const void * GetBuffer() const
Get pointer to the data. NULL if not yet attached.
Definition: bdb_types.hpp:2213
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
Pool::TValue * Release()
Return the pointer to the caller, not to the pool.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
enum ENcbiOwnership EOwnership
Ownership relations between objects.
char * buf
#define BF(A, B, I)
Multi-threading – mutexes; rw-locks; semaphore.
static pcre_uint8 * buffer
Definition: pcretest.c:1051
Interface defines async.
@ eFailed
Last operation failed and interface cannot recover.
@ eReady
Volume is ready.
@ eNotReady
Last request did not finish yet.
Interface to store merged BLOBs.
Interface to traverse volume for merge.
#define _ASSERT
Modified on Mon May 27 04:39:03 2024 by modify_doxy.py rev. 669887