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

Go to the SVN repository for this file.

1 #ifndef NETCACHE__NC_DB_FILES__HPP
2 #define NETCACHE__NC_DB_FILES__HPP
3 /* $Id: nc_db_files.hpp 56139 2012-11-02 12:36:58Z gouriano $
4  * ===========================================================================
5  *
6  * PUBLIC DOMAIN NOTICE
7  * National Center for Biotechnology Information
8  *
9  * This software/database is a "United States Government Work" under the
10  * terms of the United States Copyright Act. It was written as part of
11  * the author's official duties as a United States Government employee and
12  * thus cannot be copyrighted. This software/database is freely available
13  * to the public for use. The National Library of Medicine and the U.S.
14  * Government have not placed any restriction on its use or reproduction.
15  *
16  * Although all reasonable efforts have been taken to ensure the accuracy
17  * and reliability of the software and data, the NLM and the U.S.
18  * Government do not and cannot warrant the performance or results that
19  * may be obtained by using this software or data. The NLM and the U.S.
20  * Government disclaim all warranties, express or implied, including
21  * warranties of performance, merchantability or fitness for any particular
22  * purpose.
23  *
24  * Please cite the author in any work or product based on this material.
25  *
26  * ===========================================================================
27  *
28  * Authors: Pavel Ivanov
29  */
30 
31 #include <corelib/ncbithr.hpp>
33 
34 #include "nc_db_info.hpp"
35 #include "nc_utils.hpp"
36 
37 
39 
40 
41 class CNCDBStat;
42 
43 
44 /// Connection to index database in NetCache storage. Database contains
45 /// information about storage parts containing actual blobs data.
47 {
48 public:
49  /// Create connection to index database file
50  ///
51  /// @param file_name
52  /// Name of the database file
53  /// @param stat
54  /// Object for gathering database statistics
55  CNCDBIndexFile(const string& file_name);
56  virtual ~CNCDBIndexFile(void);
57 
58  /// Create entire database structure for Index file
59  void CreateDatabase(void);
60 
61  /// Create new database part and save information about it.
62  /// Creation time in given info structure is set to current time.
63  void NewDBFile(Uint4 file_id, const string& file_name);
64  /// Delete database part
65  void DeleteDBFile(Uint4 file_id);
66  /// Read information about all database parts in order of their creation
67  void GetAllDBFiles(TNCDBFilesMap* files_map);
68  /// Clean index database removing information about all database parts.
69  void DeleteAllDBFiles(void);
70 
72  void SetMaxSyncLogRecNo(Uint8 rec_no);
73 
74  string GetPurgeData(void);
75  void UpdatePurgeData(const string& data);
76 
77 private:
80 };
81 
82 
83 
84 //////////////////////////////////////////////////////////////////////////
85 // Inline methods
86 //////////////////////////////////////////////////////////////////////////
87 
88 inline
91  fJournalDelete | fVacuumOff | fExternalMT
92  | fSyncFull | fWritesSync)
93 {
94  SetPageSize(4096);
95 }
96 
98 
99 #endif /* NETCACHE__NC_DB_FILES__HPP */
Connection to index database in NetCache storage.
Definition: nc_db_files.hpp:47
CNCDBIndexFile & operator=(const CNCDBIndexFile &)
void DeleteDBFile(Uint4 file_id)
Delete database part.
Definition: nc_db_files.cpp:97
CNCDBIndexFile(const CNCDBIndexFile &)
void SetMaxSyncLogRecNo(Uint8 rec_no)
string GetPurgeData(void)
Uint8 GetMaxSyncLogRecNo(void)
void GetAllDBFiles(TNCDBFilesMap *files_map)
Read information about all database parts in order of their creation.
void CreateDatabase(void)
Create entire database structure for Index file.
Definition: nc_db_files.cpp:57
CNCDBIndexFile(const string &file_name)
Create connection to index database file.
Definition: nc_db_files.hpp:89
void DeleteAllDBFiles(void)
Clean index database removing information about all database parts.
void NewDBFile(Uint4 file_id, const string &file_name)
Create new database part and save information about it.
Definition: nc_db_files.cpp:80
virtual ~CNCDBIndexFile(void)
Definition: nc_db_files.cpp:53
void UpdatePurgeData(const string &data)
Connection to SQLite database.
void SetPageSize(unsigned int size)
Set page size for the database (in bytes).
Definition: map.hpp:338
const char * file_name[]
char data[12]
Definition: iconv.c:80
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Multi-threading – classes, functions, and features.
Modified on Fri Sep 20 14:58:05 2024 by modify_doxy.py rev. 669887