Data_deduplication_service
Service that will use hashes to deduplicate files
dbCommon.h File Reference
#include <fstream>
#include <functional>
#include <memory>
#include <pqxx/pqxx>
#include "expected.hpp"
#include "myConnString.h"
#include "myConcepts.h"
#include "HashUtils.h"
+ Include dependency graph for dbCommon.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 db_services
 db_services namespace
 

Typedefs

using db_services::indexType = int64_t
 
using db_services::trasnactionType = pqxx::transaction< pqxx::isolation_level::read_committed >
 
using db_services::connectionType = pqxx::connection
 
using db_services::conPtr = std::shared_ptr< connectionType >
 
using db_services::resType = pqxx::result
 
using db_services::nonTransType = pqxx::nontransaction
 

Functions

std::string db_services::toSpacedPath (std::string_view path)
 
std::string db_services::fromSpacedPath (std::string_view path)
 
std::string db_services::toTsquerablePath (std::string_view path)
 
bool db_services::checkConnection (const conPtr &conn)
 
bool db_services::checkConnString (const myConnString &connString)
 
tl::expected< conPtr, returnCodes > db_services::connectIfPossible (std::string_view cString)
 
resType db_services::terminateAllDbConnections (nonTransType &noTransExec, std::string_view dbName)
 
resType db_services::checkDatabaseExistence (nonTransType &noTransExec, std::string_view dbName)
 
resType db_services::checkSchemas (trasnactionType &txn)
 
indexType db_services::checkSegmentCount (trasnactionType &txn)
 
resType db_services::deleteUnusedSegments (trasnactionType &txn)
 
resType db_services::checkFileExistence (trasnactionType &txn, std::string_view fileName)
 
resType db_services::checkFilesExistence (trasnactionType &txn, const std::vector< std::filesystem::path > &files)
 
indexType db_services::getFileId (trasnactionType &txn, std::string_view fileName)
 
bool db_services::doesFileExist (trasnactionType &txn, std::string_view fileName)
 
resType db_services::getEntriesForDirectory (trasnactionType &txn, std::string_view dirPath)
 
std::vector< indexType > db_services::getFileIdVector (trasnactionType &txn, std::string_view dirPath)
 
tl::expected< indexType, int > db_services::getTotalFileSize (trasnactionType &txn)
 
resType db_services::getTotalSchemaSizes (trasnactionType &txn)
 
resType db_services::getDedupCharacteristics (trasnactionType &txn)
 
resType db_services::getFileSizes (trasnactionType &txn)
 
void db_services::printRes (resType &rss, std::ostream &out)
 
template<printable T>
std::string db_services::vecToString (std::vector< T > &vec)
 
void db_services::printRowsAffected (const resType &res)
 
resType db_services::checkTExistence (db_services::trasnactionType &txn, std::string_view fileName)
 
myConnString db_services::loadConfiguration (std::string_view filename)
 
template<typename T , unsigned long size>
std::array< T, size > db_services::fromString (std::basic_string< T > &string)
 
template<typename ResultType , typename ... Args>
tl::expected< ResultType, int > db_services::executeInTransaction (conPtr &conn, ResultType(*call)(trasnactionType &, Args ...), Args &&... args)
 
template<typename ResultType , typename ... Args>
tl::expected< ResultType, int > db_services::executeInTransaction (conPtr &conn, const std::function< ResultType(trasnactionType &, Args ...)> &call, Args &&... args)