Explorar el Código

stash: add reset method

Lennart Braun hace 3 años
padre
commit
e7a926182d
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      oram/src/stash.rs

+ 6 - 0
oram/src/stash.rs

@@ -49,6 +49,8 @@ pub trait Stash<F: PrimeField> {
 
 
     fn get_access_counter(&self) -> usize;
     fn get_access_counter(&self) -> usize;
 
 
+    fn reset(&mut self);
+
     fn init<C: AbstractCommunicator>(&mut self, comm: &mut C) -> Result<(), Error>;
     fn init<C: AbstractCommunicator>(&mut self, comm: &mut C) -> Result<(), Error>;
 
 
     fn read<C: AbstractCommunicator>(
     fn read<C: AbstractCommunicator>(
@@ -257,6 +259,10 @@ where
         self.access_counter
         self.access_counter
     }
     }
 
 
+    fn reset(&mut self) {
+        *self = Self::new(self.party_id, self.stash_size);
+    }
+
     fn init<C: AbstractCommunicator>(&mut self, comm: &mut C) -> Result<(), Error> {
     fn init<C: AbstractCommunicator>(&mut self, comm: &mut C) -> Result<(), Error> {
         assert_eq!(self.state, State::New);
         assert_eq!(self.state, State::New);