Browse Source

stash: add reset method

Lennart Braun 2 years ago
parent
commit
e7a926182d
1 changed files with 6 additions and 0 deletions
  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 reset(&mut self);
+
     fn init<C: AbstractCommunicator>(&mut self, comm: &mut C) -> Result<(), Error>;
 
     fn read<C: AbstractCommunicator>(
@@ -257,6 +259,10 @@ where
         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> {
         assert_eq!(self.state, State::New);