-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBManager.hpp
More file actions
67 lines (59 loc) · 2.13 KB
/
Copy pathDBManager.hpp
File metadata and controls
67 lines (59 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: DBManager.hpp
* Author: mahdi
*
* Created on August 28, 2019, 2:41 PM
*/
#ifndef DBMANAGER_HPP
#define DBMANAGER_HPP
#include <vector>
#include <string>
#include <gmp.h>
class DBManager {
public:
DBManager(const int t_verbose, const int t_oneFileDB, const int t_pirVersion);
int processDBDirectory(const std::string t_directory);
int processDBFile(const std::string t_DBfile, const size_t t_M, const size_t t_N);
int loadEntireDBtoMemory();
int loadEntireDBtoMemory_mpz();
DBManager(const DBManager& orig);
virtual ~DBManager();
//Class setters and getters
size_t getN();
size_t getN2();
size_t getM();
int getPirVersion();
int getDBinOneFile();
unsigned char *getDBbuffer();
size_t getDBbufferSize();
mpz_t *getDB_mpz_buffer();
size_t getDBBlocksCount();
size_t getFileBlocksCount();
std::vector<std::string>* getDBfilesNamesList();
std::vector<std::size_t>* getDBfilesSizesList();
std::string getDBDirectory();
std::string getDBFile();
private:
//members
int B = 128; // block size (bytes)
size_t m_N, m_N2, m_M; // N:file size, M:number of files, N2:for hybridPIR (dimension=2)
int m_oneFileDB = 0; // boolean0:db from multiple files, 1:db in a single file
int m_pirVersion = 1; // PIR version: 1:multiPIR, 2:rsaPRI, 3:hybridPIR
unsigned char *m_buffer; // buffer is one block of (chunkLength X m/8)
size_t m_bufferSize; // db buffer (db chunk) size in number of bytes
size_t m_fileBlocksCount = 0; // number of blocks per file
mpz_t *m_mpz_buffer; // buffer is one block
size_t m_dbBlocksCount = 0; // number of blocks per file
std::string m_DBdirectory;
std::string m_DBfile;
std::vector<std::string> m_dbFilesNamesList;
std::vector<size_t> m_dbFilesSizesList;
int m_verbose = 0;
std::string dummyFileName = "dummyFile.data";
};
#endif /* DBMANAGER_HPP */