Skip to content

Commit

Permalink
fix: rebase on develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrezot committed Aug 1, 2023
1 parent c85c81a commit 367439b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/in_memory_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ impl<const UID_LENGTH: usize> FindexInMemory<UID_LENGTH> {

pub fn dump_tables(&self) -> Result<Vec<u8>, ExampleError> {
let mut ser = Serializer::new();
ser.write(&self.entry_table)
ser.write(&*self.entry_table.read().expect("entry table lock poisoned"))
.map_err(|e| ExampleError(e.to_string()))?;
ser.write(&self.chain_table)
ser.write(&*self.chain_table.read().expect("chain table lock poisoned"))
.map_err(|e| ExampleError(e.to_string()))?;
Ok(ser.finalize().to_vec())
}

pub fn load_tables(&mut self, bytes: &[u8]) -> Result<(), ExampleError> {
pub fn load_tables(&self, bytes: &[u8]) -> Result<(), ExampleError> {
let mut de = Deserializer::new(bytes);
self.entry_table = de
*self.entry_table.write().expect("entry table lock poisoned") = de
.read::<EncryptedTable<UID_LENGTH>>()
.map_err(|e| ExampleError(e.to_string()))?;
self.chain_table = de
*self.chain_table.write().expect("chain table lock poisoned") = de
.read::<EncryptedTable<UID_LENGTH>>()
.map_err(|e| ExampleError(e.to_string()))?;
if !de.finalize().is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions tests/non_regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn write_index() -> Result<(), Error<ExampleError>> {
let master_key = KeyingMaterial::new(&mut rng);
let label = Label::random(&mut rng);

let mut findex = FindexInMemory::default();
let findex = FindexInMemory::default();

let reader = BufReader::new(File::open("datasets/first_names.txt").unwrap());
for maybe_line in reader.lines().take(MAX_FIRST_NAMES) {
Expand Down Expand Up @@ -87,7 +87,7 @@ async fn test_non_regression() -> Result<(), Error<ExampleError>> {
// Uncomment to generate new test data.
// write_index().await?;

let mut findex = FindexInMemory::<UID_LENGTH>::default();
let findex = FindexInMemory::<UID_LENGTH>::default();
let serialized_index = std::fs::read("datasets/serialized_index").unwrap();
findex.load_tables(&serialized_index)?;

Expand Down

0 comments on commit 367439b

Please sign in to comment.