QDP++
QDP::BinaryStoreDB< K, D > Class Template Reference

DB Base class. More...

#include <qdp_db_imp.h>

Public Member Functions

 BinaryStoreDB ()
 ~BinaryStoreDB ()
virtual void setCacheSize (const unsigned int size)
virtual void setCacheSizeMB (const unsigned int size)
virtual void setPageSize (const unsigned int size)
virtual void setNumberBuckets (const unsigned int num)
virtual void enablePageMove (void)
virtual void disablePageMove (void)
virtual void setMaxUserInfoLen (unsigned int len)
virtual unsigned int getMaxUserInfoLen (void) const
virtual void setMaxNumberConfigs (unsigned int num)
virtual unsigned int getMaxNumberConfigs (void) const
virtual bool fileExists (const std::string &file) const
virtual void open (const std::string &file, int open_flags, int mode)
virtual void close (void)
bool exist (const K &key)
void insert (const K &key, const D &data)
void insertBinary (const std::string &key, const std::string &data)
int get (const K &key, D &data)
int getBinary (const std::string &key, std::string &data)
virtual void keys (std::vector< K > &keys_)
virtual void keysAndData (std::vector< K > &keys_, std::vector< D > &values_)
virtual void binaryKeysAndData (std::vector< std::string > keys_, std::vector< std::string > values_)
virtual void flush (void)
virtual std::string storageName (void) const
virtual void insertUserdata (const std::string &user_data)
virtual void getUserdata (std::string &user_data)
 BinaryStoreDB ()
virtual ~BinaryStoreDB ()
virtual void setCacheSize (const unsigned int size)
virtual void setCacheSizeMB (const unsigned int size)
virtual void setPageSize (const unsigned int size)
virtual void setNumberBuckets (const unsigned int num)
virtual void enablePageMove (void)
virtual void disablePageMove (void)
virtual void setMaxUserInfoLen (unsigned int len)
virtual unsigned int getMaxUserInfoLen (void) const
virtual void setMaxNumberConfigs (unsigned int num)
virtual unsigned int getMaxNumberConfigs (void) const
virtual bool fileExists (const std::string &file) const
virtual void open (const std::string &file, int open_flags, int mode)
virtual void close (void)
bool exist (const K &key)
void insert (const K &key, const D &data)
void insertBinary (const std::string &key, const std::string &data)
int get (K &key, D &data)
int getBinary (std::string &key, std::string &data)
virtual void keys (std::vector< K > &keys_)
virtual void keysAndData (std::vector< K > &keys_, std::vector< D > &values_)
virtual void binaryKeysAndData (std::vector< std::string > keys_, std::vector< std::string > values_)
virtual void flush (void)
virtual std::string storageName (void) const
virtual void insertUserdata (const std::string &user_data)
virtual void getUserdata (std::string &user_data)

Detailed Description

template<typename K, typename D>
class QDP::BinaryStoreDB< K, D >

DB Base class.

This class is used for writing of user data (most usefully measurements) into a DB file with a key/value semantics.

Definition at line 38 of file qdp_db_imp.h.

Constructor & Destructor Documentation

◆ BinaryStoreDB()

template<typename K, typename D>
QDP::BinaryStoreDB< K, D >::BinaryStoreDB ( )
inline

Empty constructor for a DB

Definition at line 161 of file qdp_db_stub.h.

◆ ~BinaryStoreDB()

template<typename K, typename D>
virtual QDP::BinaryStoreDB< K, D >::~BinaryStoreDB ( )
inlinevirtual

Destroy the object

Definition at line 166 of file qdp_db_stub.h.

Member Function Documentation

◆ binaryKeysAndData()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::binaryKeysAndData ( std::vector< std::string > keys_,
std::vector< std::string > values_ )
inlinevirtual

Return all pairs of keys and data in binary string form

Parameters
keysuser supplied empty vector to hold all keys
datauser supplied empty vector to hold data
Returns
keys and data in the vectors having the same size

Definition at line 318 of file qdp_db_stub.h.

◆ close()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::close ( void )
inlinevirtual

Definition at line 252 of file qdp_db_stub.h.

◆ disablePageMove()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::disablePageMove ( void )
inlinevirtual

Definition at line 217 of file qdp_db_stub.h.

◆ enablePageMove()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::enablePageMove ( void )
inlinevirtual

Set whether to move pages when close to save disk space

This only effective on writable database

Definition at line 215 of file qdp_db_stub.h.

◆ exist()

template<typename K, typename D>
bool QDP::BinaryStoreDB< K, D >::exist ( const K & key)
inline

Does this key exist in the store

Parameters
keya key object
Returns
true if the answer is yes

Definition at line 259 of file qdp_db_stub.h.

◆ fileExists()

template<typename K, typename D>
virtual bool QDP::BinaryStoreDB< K, D >::fileExists ( const std::string & file) const
inlinevirtual

Check if a DB file exists before opening.

Definition at line 237 of file qdp_db_stub.h.

◆ flush()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::flush ( void )
inlinevirtual

Flush database in memory to disk

Definition at line 325 of file qdp_db_stub.h.

◆ getMaxNumberConfigs()

template<typename K, typename D>
virtual unsigned int QDP::BinaryStoreDB< K, D >::getMaxNumberConfigs ( void ) const
inlinevirtual

Definition at line 232 of file qdp_db_stub.h.

◆ getMaxUserInfoLen()

template<typename K, typename D>
virtual unsigned int QDP::BinaryStoreDB< K, D >::getMaxUserInfoLen ( void ) const
inlinevirtual

Definition at line 225 of file qdp_db_stub.h.

◆ getUserdata()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::getUserdata ( std::string & user_data)
inlinevirtual

Get user user data from the metadata database

Parameters
user_datauser supplied buffer to store user data
Returns
returns 0 if success. Otherwise failure.

Definition at line 349 of file qdp_db_stub.h.

◆ insert()

template<typename K, typename D>
void QDP::BinaryStoreDB< K, D >::insert ( const K & key,
const D & data )
inline

Insert a pair of data and key into the database data is not ensemble, but a vector of complex.

Parameters
keya key
dataa user provided data
Returns
0 on successful write, -1 on failure with proper errno set

Definition at line 269 of file qdp_db_stub.h.

◆ insertBinary()

template<typename K, typename D>
void QDP::BinaryStoreDB< K, D >::insertBinary ( const std::string & key,
const std::string & data )
inline

Insert a pair of data and key into the database in string format

Parameters
keya key
dataa user provided data
Returns
0 on successful write, -1 on failure with proper errno set

Definition at line 278 of file qdp_db_stub.h.

◆ insertUserdata()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::insertUserdata ( const std::string & user_data)
inlinevirtual

Insert user data into the metadata database

Parameters
user_datauser supplied data
Returns
returns 0 if success, else failure

Definition at line 341 of file qdp_db_stub.h.

◆ keys()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::keys ( std::vector< K > & keys_)
inlinevirtual

Return all available keys to user

Parameters
keysuser suppled an empty vector which is populated by keys after this call.

Definition at line 302 of file qdp_db_stub.h.

◆ keysAndData()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::keysAndData ( std::vector< K > & keys_,
std::vector< D > & values_ )
inlinevirtual

Return all pairs of keys and data

Parameters
keysuser supplied empty vector to hold all keys
datauser supplied empty vector to hold data
Returns
keys and data in the vectors having the same size

Definition at line 310 of file qdp_db_stub.h.

◆ open()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::open ( const std::string & file,
int open_flags,
int mode )
inlinevirtual

Open

Parameters
filefilename holding all data and keys
open_flagscan be regular UNIX file open flags such as: O_RDONLY, O_RDWR, O_TRUNC
moderegular unix file mode
Returns
0 on success, -1 on failure with proper errno set

Definition at line 250 of file qdp_db_stub.h.

◆ setCacheSize()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::setCacheSize ( const unsigned int size)
inlinevirtual
   How much data and keys should be kept in memory in bytes

o * This should be called before the open is called

Parameters
max_cache_sizenumber of bytes of data and keys should be kept in memory

Definition at line 175 of file qdp_db_stub.h.

◆ setCacheSizeMB()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::setCacheSizeMB ( const unsigned int size)
inlinevirtual

How much data and keys should be kept in memory in megabytes

This should be called before the open is called

Parameters
max_cache_sizenumber of bytes of data and keys should be kept in memory

Definition at line 184 of file qdp_db_stub.h.

◆ setMaxNumberConfigs()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::setMaxNumberConfigs ( unsigned int num)
inlinevirtual

Set and get maximum number of configurations

Definition at line 230 of file qdp_db_stub.h.

◆ setMaxUserInfoLen()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::setMaxUserInfoLen ( unsigned int len)
inlinevirtual

Set and get maximum user information length

Definition at line 223 of file qdp_db_stub.h.

◆ setNumberBuckets()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::setNumberBuckets ( const unsigned int num)
inlinevirtual

Set initial number of buckets

This should be called before the open is called

Parameters
numthe number of buckets should be used

Definition at line 206 of file qdp_db_stub.h.

◆ setPageSize()

template<typename K, typename D>
virtual void QDP::BinaryStoreDB< K, D >::setPageSize ( const unsigned int size)
inlinevirtual

Page size used when a new data based is created This only effects a new database

Parameters
pagesizethe pagesize used in hash database. This value should be power of 2. The minimum value is 512 and maximum value is 262144

Definition at line 195 of file qdp_db_stub.h.

◆ storageName()

template<typename K, typename D>
virtual std::string QDP::BinaryStoreDB< K, D >::storageName ( void ) const
inlinevirtual

Name of database associated with this Data store

Returns
database name

Definition at line 332 of file qdp_db_stub.h.


The documentation for this class was generated from the following files: