22 #ifndef __PERCYSERVER_H__
23 #define __PERCYSERVER_H__
26 #include "datastore.h"
28 #include "percystats.h"
70 const std::vector<std::iostream*> &workers =
71 std::vector<std::iostream*>());
79 virtual bool handle_request (
const std::vector<std::istream *> &isv,
80 const std::vector<std::ostream *> &osv,
81 const std::vector<std::iostream*> &workers =
82 std::vector<std::iostream*>());
86 friend void * thread_work (
void * arg);
94 const std::vector<unsigned char*> &requests,
95 const std::vector<unsigned char*> &responses) = 0;
105 const std::vector<unsigned char*> &requests,
106 const std::vector<unsigned char*> &responses,
107 const std::vector<std::iostream*> &workers);
115 const std::vector<unsigned char*> &requests,
116 const std::vector<unsigned char*> &responses);
124 const std::vector<unsigned char*> &worker_results) = 0;
150 template <
typename GF2E_Element>
class Matrix;
151 template <
typename GF2E_Element>
class SubMatrix;
152 template <
typename GF2E_Element>
class Col;
153 template <
typename GF2E_Element>
class Row;
154 template <
typename GF2E_Element>
class Elem;
156 template <
typename GF2E_Element_>
157 friend std::ostream &
operator<<(std::ostream &os,
159 template <
typename GF2E_Element_>
160 friend std::ostream &
operator<<(std::ostream &os,
164 std::vector<nqueries_t> split_queries (nqueries_t num_queries,
165 nservers_t num_workers);
167 #include "gf2e_matrix.h"
nqueries_t get_strassen_max_depth()
Get the strassen max level.
virtual bool handle_request_threaded(const std::vector< unsigned char * > &requests, const std::vector< unsigned char * > &responses)
Implementation of handle_request() to be used when using multithreading.
std::ostream & operator<<(std::ostream &os, PercyMode mode)
Prints a PercyMode string to a stream.
Definition: percystats.h:66
virtual bool handle_request_impl(const std::vector< unsigned char * > &requests, const std::vector< unsigned char * > &responses)=0
Implementation of handle_request().
nqueries_t strassen_level_reached
The strassen level reached in computation.
Definition: percyserver.h:145
const PercyServerParams * serverparams
The parameters for the server.
Definition: percyserver.h:139
bool byzantine
Whether or not the server is Byzantine.
Definition: percyserver.h:135
A simple database object.
Definition: datastore.h:34
virtual void combine_results(unsigned char *result, const std::vector< unsigned char * > &worker_results)=0
Combines the results of threads/workers when partitioning database records (DIST_SPLIT_RECORDS).
virtual bool handle_request_distributed(const std::vector< unsigned char * > &requests, const std::vector< unsigned char * > &responses, const std::vector< std::iostream * > &workers)
Implementation of handle_request() used for master servers.
Definition: gf2e_matrix.h:110
PercyStats * stats
Statistics collection object.
Definition: percyserver.h:141
An abstract base class for a PIR server.
Definition: percyserver.h:34
void set_strassen_max_depth(nqueries_t depth)
Set the strassen max level.
Definition: gf2e_matrix.h:129
virtual ~PercyServer()
Destructor.
Definition: gf2e_matrix.h:95
virtual bool handle_request(std::istream &is, std::ostream &os, const std::vector< std::iostream * > &workers=std::vector< std::iostream * >())
Handle a request from a single client.
void be_byzantine()
Tell the server to be Byzantine.
PercyServer(DataStore *datastore, const PercyServerParams *serverparams, PercyStats *stats=NULL)
Constructor.
Definition: gf2e_matrix.h:31
A PIR server for recursive PIR protocols.
Definition: recursiveserver.h:31
nqueries_t strassen_max_depth
Maximum depth allowed when using Strassen's matrix multiplication.
Definition: percyserver.h:143
static const nqueries_t STRASSEN_OPTIMAL
Special strassen max level, when set to this value, the optimal strategy is used. ...
Definition: percyserver.h:53
Server parameters.
Definition: percyparams.h:251
DataStore * datastore
The database used by the server.
Definition: percyserver.h:137
Defines the basic structure of protocol parameters (PercyParams), client parameters (PercyClientParam...
std::vector< PercyServer * > subservers
When using multithreading, the server objects for the threads.
Definition: percyserver.h:147
Definition: gf2e_matrix.h:61
static PercyServer * make_server(DataStore *datastore, const PercyServerParams *params, PercyStats *stats=NULL)
Factory method called to get a server object for the given parameters.