|
@@ -7,7 +7,6 @@ use rayon::prelude::*;
|
|
|
|
|
|
use spiral_rs::client::PublicParameters;
|
|
|
use spiral_rs::client::Query;
|
|
|
-use spiral_rs::params::Params;
|
|
|
use spiral_rs::server::process_query;
|
|
|
|
|
|
use crate::db_encrypt;
|
|
@@ -21,7 +20,6 @@ use crate::PreProcSingleRespMsg;
|
|
|
use crate::VecData;
|
|
|
|
|
|
enum Command {
|
|
|
- PubParams(Vec<u8>),
|
|
|
PreProcMsg(Vec<PreProcSingleMsg>),
|
|
|
QueryMsg(usize, usize, usize, DbEntry),
|
|
|
}
|
|
@@ -38,8 +36,6 @@ struct PreProcSingleState<'a> {
|
|
|
}
|
|
|
|
|
|
pub struct Server {
|
|
|
- r: usize,
|
|
|
- thread_handle: JoinHandle<()>,
|
|
|
incoming_cmd: SyncSender<Command>,
|
|
|
outgoing_resp: Receiver<Response>,
|
|
|
}
|
|
@@ -48,7 +44,7 @@ impl Server {
|
|
|
pub fn new(r: usize, pub_params: Vec<u8>) -> Self {
|
|
|
let (incoming_cmd, incoming_cmd_recv) = sync_channel(0);
|
|
|
let (outgoing_resp_send, outgoing_resp) = sync_channel(0);
|
|
|
- let thread_handle = spawn(move || {
|
|
|
+ spawn(move || {
|
|
|
let spiral_params = params::get_spiral_params(r);
|
|
|
let pub_params = PublicParameters::deserialize(&spiral_params, &pub_params);
|
|
|
let num_records = 1 << r;
|
|
@@ -118,13 +114,13 @@ impl Server {
|
|
|
);
|
|
|
outgoing_resp_send.send(Response::QueryResp(resp)).unwrap();
|
|
|
}
|
|
|
- _ => panic!("Received something unexpected"),
|
|
|
+ // When adding new messages, the following line is
|
|
|
+ // useful during development
|
|
|
+ // _ => panic!("Received something unexpected in server loop"),
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
Server {
|
|
|
- r,
|
|
|
- thread_handle,
|
|
|
incoming_cmd,
|
|
|
outgoing_resp,
|
|
|
}
|