Skip to content
Snippets Groups Projects
Unverified Commit 62d2b069 authored by Cheuk Pui Lam's avatar Cheuk Pui Lam
Browse files

fix(client-brc): fixed partition saving

parent d8f8a349
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,5 @@ venv
*.json
*.log
*.key
*.partitions
\ No newline at end of file
use std::collections::HashMap;
use std::io::Write;
use anyhow::{anyhow, Result};
use indexmap::IndexMap;
......@@ -83,7 +84,9 @@ pub fn init(
debug!("{:?}", hm);
let hashtable = brc_tree::from_sorted_list(hm).to_hm();
let mut json: HashMap<String, String> = HashMap::new();
let mut file = std::fs::File::create("brc_table.partitions")?;
for (key, value) in hashtable.iter() {
file.write(format!("{},{};", key.0, key.1).as_bytes())?;
for (counter, record) in value.iter().enumerate() {
let encrypted = encrypt(&enc_key, record.to_string())?;
let prfd_key = prf(&prf_key, format!("{:?}", key))?;
......@@ -98,5 +101,6 @@ pub fn init(
for i in json.iter() {
println!("{:?}", i);
}
println!("{}", json.len());
Ok(())
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment