18#ifndef MS_CDB_SHARDING_HPP
19#define MS_CDB_SHARDING_HPP
23using namespace matrix_science;
25namespace msparser_internal {
27 class CdbPreparingHelper
38 static bool moveFileSafely(
const std::string & sourceFile,
const std::string & targetFile, std::string & strError);
49 static bool archiveFileToDirectory(
const std::string & archiveDir,
const std::string & sourceFile,
const std::string & targetFile, std::string & strError);
60 static bool moveAllFilesInDirectory(
const std::string & sourceDir,
const std::string & targetDir, std::string & strError,
const ms_taxonomyrules * taxRules =
nullptr);
76 CdbShard(
const std::string & baseFileName,
const char letter,
const unsigned numCbdFiles,
const bool keepFilesOpen,
const bool splitShards);
85 bool isGood()
const {
return success_; };
104 std::string openFiles();
116 void retargetFiles(
const std::string & targetBaseFileName,
const std::string & compressionDir,
const std::string & targetDir);
123 char getLetter()
const {
return letter_; };
130 int getNumCdb()
const {
return static_cast<int>(vecCdbFiles_.size()); };
138 int getIntValue(
const std::string & key)
const;
147 bool setIntValue(
const std::string & key,
const int intValue);
150 std::string getCdbFileName(
char c,
int num)
const;
152 std::string baseFileName_;
155 UINT64 currentCdbSize_;
156 unsigned currentCdbFileIdx_;
157 unsigned numCdbFiles_;
163 std::vector<matrix_science::ms_tinycdb *> vecCdbFiles_;
178 CdbSharding(
const std::string & baseFileName,
const bool keepFilesOpen,
const bool splitShards,
const std::string preparingDir =
".");
194 bool mustCreate() {
return mustCreate_; }
201 bool prepareShards();
208 std::string getWorkingBaseFileName();
215 bool finaliseShards();
236 int getIntValue(
const std::string & accession)
const;
245 bool setIntValue(
const std::string & accession,
const int intValue);
248 bool deletePreviousFiles();
249 bool isNumberOrLetter(
const char c)
const;
250 CdbShard * getShardForAccession(
const std::string & accession)
const;
252 std::string baseFileName_;
262 std::vector<CdbShard *> vecCharToShard_;
263 std::vector<CdbShard *> vecShards_;
265 std::string preparingDir_;
266 std::string sourceDir_;
267 std::string baseFileName_withoutPath_;
268 bool differentCompressionDir_;
269 std::string working_baseFileName_;
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
This class represents a single Taxonomy_XXX section in mascot.dat.
Definition: ms_taxonomyrules.hpp:247
Wrapper for the public domain tinycdb package http://www.corpit.ru/mjt/tinycdb.html by Michael Tokare...
Definition: ms_tinycdb.hpp:124