Percy++
A C++ implementation of Private Information Retrieval (PIR) protocols
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Attributes | List of all members
DataStore Class Reference

A simple database object. More...

#include <datastore.h>

Inheritance diagram for DataStore:
FileDataStore

Public Member Functions

 DataStore (unsigned char *database, const PercyServerParams *params)
 Constructor. More...
 
virtual ~DataStore ()
 Destructor. More...
 
const unsigned char * get_data () const
 Get a pointer to the database in memory. More...
 
void set_database (unsigned char *data=NULL)
 Change the database pointer. More...
 
vector< DataStore * > get_worker_datastores () const
 Get the database objects for the threads/workers. More...
 
DataStoreget_worker_datastore (nservers_t worker_index) const
 Get the database object for a thread/worker. More...
 

Protected Attributes

const PercyServerParamsserverparams
 Parameters for the server. More...
 
const PercyParamsparams
 Parameters for the protocol. More...
 
dbsize_t block_size
 Size of each database block in bytes. More...
 
dbsize_t num_blocks
 Number of blocks in the database. More...
 
dbsize_t database_size
 Total size of the database in bytes. More...
 
nservers_t num_workers
 Number of threads/workers. More...
 
std::vector< dbsize_t > subdb_offsets
 The distance from the beginning of the database that each thread/worker's portion of the database begins. More...
 
std::vector< DataStore * > subdatastores
 The database objects for the threads/workers. More...
 

Detailed Description

A simple database object.

Stores a database that is a contiguous block of memory.

Constructor & Destructor Documentation

DataStore ( unsigned char *  database,
const PercyServerParams params 
)

Constructor.

Parameters
databaseA pointer to the database in memory.
paramsThe server parameters.
virtual ~DataStore ( )
virtual

Destructor.

Member Function Documentation

const unsigned char* get_data ( ) const
inline

Get a pointer to the database in memory.

Returns
The database pointer.
DataStore* get_worker_datastore ( nservers_t  worker_index) const
inline

Get the database object for a thread/worker.

Parameters
worker_indexThe index of a worker.
Returns
The database object for the worker.
vector<DataStore*> get_worker_datastores ( ) const
inline

Get the database objects for the threads/workers.

Returns
The database objects for the workers.
void set_database ( unsigned char *  data = NULL)

Change the database pointer.

Parameters
dataThe location of the new database in memory.

Member Data Documentation

dbsize_t block_size
protected

Size of each database block in bytes.

dbsize_t database_size
protected

Total size of the database in bytes.

dbsize_t num_blocks
protected

Number of blocks in the database.

nservers_t num_workers
protected

Number of threads/workers.

const PercyParams* params
protected

Parameters for the protocol.

const PercyServerParams* serverparams
protected

Parameters for the server.

std::vector<DataStore*> subdatastores
protected

The database objects for the threads/workers.

std::vector<dbsize_t> subdb_offsets
protected

The distance from the beginning of the database that each thread/worker's portion of the database begins.


The documentation for this class was generated from the following file: