get fhe node data impleented, still doesnt ocmpile. need to figure out how to handle sealdata stuff

This commit is contained in:
Matthew Liu
2023-07-17 14:06:44 -07:00
parent 757f9febb3
commit 4849b2682e
4 changed files with 36 additions and 1 deletions

View File

@@ -17,8 +17,8 @@ async fn main() {
}
let app = Compiler::new()
.fhe_program(mad)
.fhe_program(add_squares)
.fhe_program(mad)
.compile()
.unwrap();

View File

@@ -82,6 +82,38 @@ async fn get_code(session: web::Path<String>) -> impl Responder {
}
}
/**
* Gets the info of a node in the debugging graph for an FHE program.
*/
#[get("graphs/{session}/{nodeid}")]
pub async fn get_fhe_node_data(
path_info: web::Path<(String, usize)>
) -> Result<HttpResponse, actix_web::Error> {
let (session, nodeid) = path_info.into_inner();
let sessions = get_sessions().lock().unwrap();
if sessions.contains_key(&session) {
let curr_session = sessions.get(&session).unwrap().unwrap_bfv_session();
let data = curr_session
.program_data
.get(nodeid)
.unwrap();
let data_json = serde_json::to_string(data).map_err(|e| {
actix_web::error::ErrorInternalServerError(format!(
"Failed to serialize node data to JSON: {}",
e
))
})?;
Ok(HttpResponse::Ok().body(data_json))
} else {
Ok(HttpResponse::NotFound().body("Node {:?} not found", nodeid))
}
}
/*
/**
* Gets node data in the compilation graph.

View File

@@ -60,6 +60,8 @@ pub struct BfvSession {
/**
* The values of operands in the compilation graph.
*/
// TODO: maybe this shouldn't be a Vec of SealData ...
pub program_data: Vec<Option<SealData>>,
/**
* Used for decryption of ciphertexts for visualization.

View File

@@ -438,6 +438,7 @@ where
fhe_program.metadata.name,
SESSION_NUM.fetch_add(1, std::sync::atomic::Ordering::Relaxed)
);
println!("session name: {:?}", session_name);
self.run_impl(
fhe_program,