|
Data_deduplication_service
Service that will use hashes to deduplicate files
|
Database manager that handles database management. More...
#include <dbManager.h>
Public Member Functions | |
| dbManager () | |
| dbManager (myConnString &ss) | |
| void | setCString (myConnString &ss) |
| const myConnString & | getCString () const |
| int | connectToDb () |
| void | disconnect () |
| int | createDatabase (std::string_view dbName) |
| int | dropDatabase (std::string_view dbName) |
| int | fillSchemas () |
| int | clearSegments () |
| std::vector< std::pair< indexType, std::string > > | getAllFiles (std::string_view dirPath) |
| indexType | createFile (std::string_view filePath, uintmax_t fileSize=0, size_t segmentSize=0, hash_function hash=SHA_256) |
| indexType | createDirectory (std::string_view dirPath) |
| int | deleteFile (std::string_view filePath, indexType fileId=paramType::EmptyParameterValue) |
| int | deleteDirectory (std::string_view directoryPath) |
| int | getFileStreamed (std::string_view fileName, std::ostream &output, indexType fileId=paramType::EmptyParameterValue) |
| int | insertFileFromStream (std::string_view fileName, std::istream &in, size_t segmentSize, std::size_t fileSize, const hash_function &hash=SHA_256) |
| int | finishFileProcessing (std::string_view filePath, indexType fileId) |
| bool | checkConnection () |
| ~dbManager () | |
| template<typename ResultType , typename ... Args> | |
| tl::expected< ResultType, int > | executeInTransaction (ResultType(*call)(trasnactionType &, Args ...), Args &&... args) |
| template<typename ResultType , typename ... Args> | |
| tl::expected< ResultType, int > | executeInTransaction (const std::function< ResultType(trasnactionType &, Args ...)> &call, Args &&... args) |
Database manager that handles database management.
This class is designed to handle main interactions for database.
You can connect/create/deelte databases.
You can send requests for file load/delete/export.
Some external helper functions can be found in dbCommon.h
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
Here is the call graph for this function:
Here is the caller graph for this function:| int db_services::dbManager::clearSegments | ( | ) |
Removes segments that are not used in files
Here is the call graph for this function:
Here is the caller graph for this function:| int db_services::dbManager::connectToDb | ( | ) |
Here is the call graph for this function:| int db_services::dbManager::createDatabase | ( | std::string_view | dbName | ) |
Creates database entry and connect to it
| dbName |
Here is the call graph for this function:| indexType db_services::dbManager::createDirectory | ( | std::string_view | dirPath | ) |
Creates entry for directory
| dirPath |
Here is the call graph for this function:
Here is the caller graph for this function:| indexType db_services::dbManager::createFile | ( | std::string_view | filePath, |
| uintmax_t | fileSize = 0, |
||
| size_t | segmentSize = 0, |
||
| hash_function | hash = SHA_256 |
||
| ) |
Creates entry for a given file
| filePath | |
| fileSize |
Here is the call graph for this function:| int db_services::dbManager::deleteDirectory | ( | std::string_view | directoryPath | ) |
Recursively deletes all file data for selected directory
| directoryPath |
Here is the call graph for this function:
Here is the caller graph for this function:| int db_services::dbManager::deleteFile | ( | std::string_view | filePath, |
| indexType | fileId = paramType::EmptyParameterValue |
||
| ) |
Recursively deletes all file data
| filePath | |
| fileId |
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Here is the call graph for this function:| int db_services::dbManager::dropDatabase | ( | std::string_view | dbName | ) |
Deletes database entry
| dbName |
Here is the call graph for this function:
|
inline |
Functional variant of previous function
| ResultType | |
| Args |
| call | |
| args |
Here is the call graph for this function:
|
inline |
Wraps function in transaction block
| ResultType | |
| Args |
| call | |
| args |
Here is the call graph for this function:| int db_services::dbManager::fillSchemas | ( | ) |
Create main database tables and indexes
Here is the call graph for this function:| int db_services::dbManager::finishFileProcessing | ( | std::string_view | filePath, |
| indexType | fileId | ||
| ) |
Process bulk inserted file data
| filePath | |
| fileId |
Here is the call graph for this function:| std::vector< std::pair< indexType, std::string > > db_services::dbManager::getAllFiles | ( | std::string_view | dirPath | ) |
Get vector of pairs of file_names and file ids for directory
| dirPath |
Here is the call graph for this function:
|
inline |
| int db_services::dbManager::getFileStreamed | ( | std::string_view | fileName, |
| std::ostream & | output, | ||
| indexType | fileId = paramType::EmptyParameterValue |
||
| ) |
Recreates file contents and bulk insert them in out stream
| fileName | |
| output | |
| fileId |
Here is the call graph for this function:| int db_services::dbManager::insertFileFromStream | ( | std::string_view | fileName, |
| std::istream & | in, | ||
| size_t | segmentSize, | ||
| std::size_t | fileSize, | ||
| const hash_function & | hash = SHA_256 |
||
| ) |
Bulk insert file segments into temporary table
| fileName | |
| in | |
| fileSize | |
| hash | hash function that will be used for hashing |
Here is the call graph for this function:
|
inline |