NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CBDB_LobFile Class Reference

Search Toolkit Book for CBDB_LobFile

Berkeley DB Large Object File class. More...

#include <db/bdb/bdb_blob.hpp>

+ Inheritance diagram for CBDB_LobFile:
+ Collaboration diagram for CBDB_LobFile:

Public Member Functions

 CBDB_LobFile ()
 
EBDB_ErrCode Insert (unsigned int lob_id, const void *data, size_t size)
 Insert BLOB data into the database, does nothing if key exists. More...
 
EBDB_ErrCode InsertUpdate (unsigned int lob_id, const void *data, size_t size)
 Insert or Update BLOB data into the database. More...
 
EBDB_ErrCode Fetch (unsigned int lob_id)
 Fetch LOB record. More...
 
EBDB_ErrCode Fetch (unsigned int lob_id, void **buf, size_t buf_size, EReallocMode allow_realloc)
 Fetch LOB record directly into the provided '*buf'. More...
 
size_t LobSize () const
 Get LOB size. Becomes available right after successfull Fetch. More...
 
EBDB_ErrCode GetData (void *buf, size_t size)
 Copy LOB data into the 'buf'. More...
 
unsigned int GetKey () const
 
virtual void SetCmp (DB *)
 Comparison function for unsigned int key. More...
 
- Public Member Functions inherited from CBDB_RawFile
 CBDB_RawFile (EDuplicateKeys dup_keys=eDuplicatesDisable, EDBType db_type=eBtree)
 
virtual ~CBDB_RawFile ()
 
void SetEnv (CBDB_Env &env)
 Associate file with environment. More...
 
CBDB_EnvGetEnv ()
 Get pointer on file environment Return NULL if no environment has been set. More...
 
void Open (const string &filename, EOpenMode open_mode, bool support_dirty_read=false, unsigned rec_len=0)
 Open file with specified access mode. More...
 
void Open (const string &filename, const string &database, EOpenMode open_mode, bool support_dirty_read=false, unsigned rec_len=0)
 Open file with specified filename and database name. More...
 
void Attach (CBDB_RawFile &bdb_file)
 Attach class to external BerkeleyDB file instance. More...
 
void Close ()
 Close file. More...
 
void Reopen (EOpenMode open_mode, bool support_dirty_read=false, unsigned rec_len=0)
 Reopen database file. (Should be already open). More...
 
void Remove (const string &filename, const string &database=kEmptyStr)
 Remove the database specified by the filename and database arguments. More...
 
unsigned int Truncate ()
 Empty the database. Return number of records removed. More...
 
unsigned int SafeTruncate ()
 Workaround for truncate of large databases. More...
 
void Rename (const string &fname, const string &old_name, const string &new_name)
 Rename a database. NOTE: This cannot be called on an opened file. More...
 
void Compact (ECompact compact_type=eCompactNoFree, int target_fill_pct=0)
 Compact the database. More...
 
void CompactEx (FContinueCompact compact_callback, ECompact compact_type=eCompactNoFree, int target_fill_pct=0)
 
void SetPageSize (unsigned int page_size)
 
unsigned int GetPageSize ()
 
void SetCacheSize (unsigned int cache_size)
 Set Berkeley DB memory cache size for the file (default is 256K). More...
 
void RevSplitOff ()
 Turn OFF reverse splitting. More...
 
void DisableCmpOverride ()
 Disable BTREE comparison override. More...
 
void SetCachePriority (ECachePriority priority)
 
const stringFileName () const
 
const stringDatabase () const
 
virtual void SetHash (DB *)
 Set hash function. More...
 
bool IsOpen () const
 Return TRUE if the file is open. More...
 
bool IsAttached () const
 
bool IsByteSwapped () const
 Return TRUE if the if the underlying database files were created on an architecture of the different byte order. More...
 
bool DuplicatesAllowed () const
 Return TRUE if file can contain duplicate keys. More...
 
EDuplicateKeys GetDupKeysMode () const
 Return the key duplicate mode value. More...
 
const stringGetFileName () const
 Return file name. More...
 
EOpenMode GetOpenMode () const
 Return the file open mode. More...
 
void Sync ()
 Flush any cached information to disk. More...
 
unsigned CountRecs (bool bFast=false)
 Compute database statistic, return number of records. More...
 
void PrintStat (CNcbiOstream &out)
 Print database statistics. More...
 
virtual void SetTransaction (ITransaction *trans)
 Establish transaction association. More...
 
virtual void RemoveTransaction (ITransaction *trans)
 Remove transaction association (must be established by SetTransaction. More...
 
virtual ITransactionGetTransaction ()
 Get current transaction. More...
 
CBDB_TransactionGetBDBTransaction ()
 Get current transaction. More...
 
unsigned GetRecLen () const
 Get record length Works for fixed length record DBs only (Queue) More...
 
void SetHashFillFactor (unsigned h_ffactor)
 Set hash table density (fill factor) More...
 
void SetHashNelem (unsigned h_nelem)
 Set an estimate of hash table final size. More...
 
void DisableHashOverride ()
 Disable hash method override (Berkeley DB will use it's own default hashing method) More...
 
void SetBtreeMinKeysPerPage (unsigned int keys_per_page)
 Set the minimum number of keys per page (BTREE access methods only) More...
 
unsigned int GetBtreeMinKeysPerPage ()
 
void SetCompressor (ICompression *compressor, EOwnership own=eTakeOwnership)
 Set record compressor. More...
 
- Public Member Functions inherited from ITransactional
virtual ~ITransactional ()
 

Private Member Functions

EBDB_ErrCode x_Put (unsigned int lob_id, const void *data, size_t size, bool can_update)
 

Private Attributes

unsigned int m_LobKey
 

Additional Inherited Members

- Public Types inherited from CBDB_RawFile
enum  EOpenMode { eReadWrite , eReadOnly , eCreate , eReadWriteCreate }
 BDB file open mode. More...
 
enum  EDBType { eBtree , eQueue , eHash }
 Berkeley DB database type. More...
 
enum  EReallocMode { eReallocAllowed , eReallocForbidden }
 BLOB read mode, controld data buffer reallocation when there is not enough space in buffer. More...
 
enum  EDuplicateKeys { eDuplicatesDisable , eDuplicatesEnable }
 Control key duplicates in Btree. More...
 
enum  EIgnoreError { eIgnoreError , eThrowOnError }
 
enum  ECompact { eCompactNoFree , eCompactFreeExisting , eCompactFreeAll }
 BerkeleyDB compaction methods and flags. More...
 
enum  ECachePriority {
  eCache_Lowest , eCache_Low , eCache_Default , eCache_High ,
  eCache_Highest
}
 Set the priority for this database's pages in the buffer cache This is generally a temporary advisement, and works only if an environment is used. More...
 
typedef CSimpleBuffer TBuffer
 typedef for raw buffer operations More...
 
typedef bool(* FContinueCompact) (void)
 Extended version of compact This version performs iterative compacting and uses a callback to request an exit. More...
 
- Static Public Attributes inherited from CBDB_RawFile
static const char kDefaultDatabase [] = "_table"
 
- Protected Member Functions inherited from CBDB_RawFile
void x_Open (const char *filename, const char *database, EOpenMode open_mode, bool support_dirty_read, unsigned rec_len)
 
void x_Create (const char *filename, const char *database)
 
void x_Close (EIgnoreError close_mode)
 
void x_CreateDB (unsigned rec_len)
 Create m_DB member, set page, cache parameters. More...
 
void x_SetTransaction (CBDB_Transaction *trans)
 Set current transaction. More...
 
void x_RemoveTransaction (CBDB_Transaction *trans)
 
DB_TXNGetTxn ()
 Get transaction handler. More...
 
DBCCreateCursor (CBDB_Transaction *trans=0, unsigned int flags=0) const
 Create DB cursor. More...
 
int x_DB_Fetch (DBT *key, DBT *data, unsigned flags)
 Internal override for DB->get(...) This method overrides destination buffer and uses compressor: Should only be used with DB_DBT_USERMEM flag. More...
 
int x_DBC_Fetch (DBC *dbc, DBT *key, DBT *data, unsigned flags)
 Internal override for DBC->c_get(...) This method overrides destination buffer and uses compressor: Should only be used with DB_DBT_USERMEM flag. More...
 
int x_DB_Put (DBT *key, DBT *data, unsigned flags)
 Override for DB->put(...) Handles compression. More...
 
int x_DB_CPut (DBC *dbc, DBT *key, DBT *data, unsigned flags)
 Override for DBC->c_put(...) Handles compression. More...
 
int x_FetchBufferDecompress (DBT *data, void *usr_data)
 
virtual void x_SetByteSwapped (bool bswp)
 Set byte order swapping. More...
 
- Protected Attributes inherited from CBDB_RawFile
EDBType m_DB_Type
 
DBm_DB
 
DBTm_DBT_Key
 
DBTm_DBT_Data
 
CBDB_Envm_Env
 
CBDB_Transactionm_Trans
 
int m_TransAssociation
 
unsigned m_RecLen
 
unsigned m_H_ffactor
 
unsigned m_H_nelem
 
unsigned m_BT_minkey
 
AutoPtr< ICompressionm_Compressor
 Record compressor. More...
 
TBuffer m_CompressBuffer
 

Detailed Description

Berkeley DB Large Object File class.

Implements simple BLOB storage based on single unsigned integer key

Definition at line 256 of file bdb_blob.hpp.


The documentation for this class was generated from the following files:
Modified on Wed Apr 17 13:10:53 2024 by modify_doxy.py rev. 669887