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

Search Toolkit Book for CNCDBIndexFile

Connection to index database in NetCache storage. More...

#include "nc_db_files.hpp"
(Private to src/app/netcache.)

+ Inheritance diagram for CNCDBIndexFile:
+ Collaboration diagram for CNCDBIndexFile:

Public Member Functions

 CNCDBIndexFile (const string &file_name)
 Create connection to index database file. More...
 
virtual ~CNCDBIndexFile (void)
 
void CreateDatabase (void)
 Create entire database structure for Index file. More...
 
void NewDBFile (Uint4 file_id, const string &file_name)
 Create new database part and save information about it. More...
 
void DeleteDBFile (Uint4 file_id)
 Delete database part. More...
 
void GetAllDBFiles (TNCDBFilesMap *files_map)
 Read information about all database parts in order of their creation. More...
 
void DeleteAllDBFiles (void)
 Clean index database removing information about all database parts. More...
 
Uint8 GetMaxSyncLogRecNo (void)
 
void SetMaxSyncLogRecNo (Uint8 rec_no)
 
string GetPurgeData (void)
 
void UpdatePurgeData (const string &data)
 
- Public Member Functions inherited from CSQLITE_Connection
 CSQLITE_Connection (CTempString file_name, TOperationFlags flags=eDefaultFlags)
 Connect to SQLite database. More...
 
 ~CSQLITE_Connection (void)
 
const stringGetFileName (void) const
 Get database file name for the connection. More...
 
TOperationFlags GetFlags (void) const
 Get flags controlling database connection operation. More...
 
void SetFlags (TOperationFlags flags)
 Change flags controlling database connection operation. More...
 
void SetPageSize (unsigned int size)
 Set page size for the database (in bytes). More...
 
unsigned int GetPageSize (void)
 Get page size used in the database (in bytes) More...
 
void SetCacheSize (unsigned int size)
 Set recommended size of the database cache (number of pages). More...
 
unsigned int GetCacheSize (void)
 Get recommended size of the database cache. More...
 
void Vacuum (size_t max_free_size)
 Try to shrink database and free up to max_free_size bytes of disk space. More...
 
CSQLITE_StatementCreateVacuumStmt (size_t max_free_size)
 Create statement for executing manual vacuuming. More...
 
void ExecuteSql (CTempString sql)
 Execute sql statement without returning any results. More...
 
void DeleteDatabase (void)
 Delete database under this connection. More...
 
sqlite3 * LockHandle (void)
 Lock and return low-level connection handle. More...
 
void UnlockHandle (sqlite3 *handle)
 Unlock unused low-level connection handle. More...
 
void SetupNewConnection (sqlite3 *handle)
 Setup newly created low-level connection handle. More...
 

Private Member Functions

 CNCDBIndexFile (const CNCDBIndexFile &)
 
CNCDBIndexFileoperator= (const CNCDBIndexFile &)
 

Additional Inherited Members

- Public Types inherited from CSQLITE_Connection
enum  EOperationFlags {
  fInternalMT = 0x00 , fExternalMT = 0x01 , fDefaultMT = fInternalMT , eAllMT = fInternalMT + fExternalMT ,
  fVacuumOn = 0x00 , fVacuumOff = 0x02 , fVacuumManual = 0x04 , fDefaultVacuum = fVacuumOn ,
  eAllVacuum = fVacuumOn + fVacuumOff + fVacuumManual , fJournalDelete = 0x00 , fJournalTruncate = 0x08 , fJournalPersist = 0x10 ,
  fJournalMemory = 0x20 , fJournalOff = 0x40 , fDefaultJournal = fJournalDelete , eAllJournal ,
  fSyncFull = 0x000 , fSyncOn = 0x080 , fSyncOff = 0x100 , fDefaultSync = fSyncFull ,
  eAllSync = fSyncOff + fSyncOn + fSyncFull , fTempToMemory = 0x000 , fTempToFile = 0x200 , fDefaultTemp = fTempToMemory ,
  eAllTemp = fTempToMemory + fTempToFile , fWritesSync = 0x000 , fWritesAsync = 0x400 , fDefaultWrites = fWritesSync ,
  eAllWrites , fReadOnly = 0x8000 , eDefaultFlags
}
 Flags controlling specifics of database connection operation. More...
 
typedef int TOperationFlags
 Bit mask of EOperationFlags. More...
 
- Static Public Member Functions inherited from CSQLITE_Connection
static CSQLITE_ConnectionCreateInMemoryDatabase (CTempString file_name, bool shared=false)
 Create a read-only copy of the database in memory. More...
 

Detailed Description

Connection to index database in NetCache storage.

Database contains information about storage parts containing actual blobs data.

Definition at line 46 of file nc_db_files.hpp.

Constructor & Destructor Documentation

◆ CNCDBIndexFile() [1/2]

CNCDBIndexFile::CNCDBIndexFile ( const string file_name)
inline

Create connection to index database file.

Parameters
file_nameName of the database file
statObject for gathering database statistics

Definition at line 89 of file nc_db_files.hpp.

References CSQLITE_Connection::SetPageSize().

◆ ~CNCDBIndexFile()

CNCDBIndexFile::~CNCDBIndexFile ( void  )
virtual

Definition at line 53 of file nc_db_files.cpp.

◆ CNCDBIndexFile() [2/2]

CNCDBIndexFile::CNCDBIndexFile ( const CNCDBIndexFile )
private

Member Function Documentation

◆ CreateDatabase()

void CNCDBIndexFile::CreateDatabase ( void  )

Create entire database structure for Index file.

Definition at line 57 of file nc_db_files.cpp.

References DBINDEX_CREATEDTIME, DBINDEX_FILEID, DBINDEX_FILENAME, DBINDEX_TABLENAME, SETTINGS_NAME, SETTINGS_TABLENAME, SETTINGS_VALUE, sql, and stmt.

◆ DeleteAllDBFiles()

void CNCDBIndexFile::DeleteAllDBFiles ( void  )

Clean index database removing information about all database parts.

Definition at line 130 of file nc_db_files.cpp.

References DBINDEX_TABLENAME, sql, and stmt.

◆ DeleteDBFile()

void CNCDBIndexFile::DeleteDBFile ( Uint4  file_id)

Delete database part.

Definition at line 97 of file nc_db_files.cpp.

References DBINDEX_FILEID, DBINDEX_TABLENAME, sql, and stmt.

◆ GetAllDBFiles()

void CNCDBIndexFile::GetAllDBFiles ( TNCDBFilesMap files_map)

Read information about all database parts in order of their creation.

Definition at line 109 of file nc_db_files.cpp.

References DBINDEX_CREATEDTIME, DBINDEX_FILEID, DBINDEX_FILENAME, DBINDEX_TABLENAME, info, sql, and stmt.

◆ GetMaxSyncLogRecNo()

Uint8 CNCDBIndexFile::GetMaxSyncLogRecNo ( void  )

Definition at line 138 of file nc_db_files.cpp.

References SETTINGS_NAME, SETTINGS_TABLENAME, SETTINGS_VALUE, sql, and stmt.

◆ GetPurgeData()

string CNCDBIndexFile::GetPurgeData ( void  )

Definition at line 164 of file nc_db_files.cpp.

References SETTINGS_NAME, SETTINGS_TABLENAME, SETTINGS_VALUE, sql, and stmt.

◆ NewDBFile()

void CNCDBIndexFile::NewDBFile ( Uint4  file_id,
const string file_name 
)

Create new database part and save information about it.

Creation time in given info structure is set to current time.

Definition at line 80 of file nc_db_files.cpp.

References CSrvTime::CurSecs(), DBINDEX_CREATEDTIME, DBINDEX_FILEID, DBINDEX_FILENAME, DBINDEX_TABLENAME, file_name, sql, and stmt.

◆ operator=()

CNCDBIndexFile& CNCDBIndexFile::operator= ( const CNCDBIndexFile )
private

◆ SetMaxSyncLogRecNo()

void CNCDBIndexFile::SetMaxSyncLogRecNo ( Uint8  rec_no)

Definition at line 152 of file nc_db_files.cpp.

References SETTINGS_TABLENAME, sql, and stmt.

◆ UpdatePurgeData()

void CNCDBIndexFile::UpdatePurgeData ( const string data)

Definition at line 178 of file nc_db_files.cpp.

References data, SETTINGS_TABLENAME, sql, and stmt.


The documentation for this class was generated from the following files:
Modified on Sat Apr 20 12:18:02 2024 by modify_doxy.py rev. 669887