pub fn apply_snapshot(&mut self, snapshot: Snapshot) -> Result<(), StorageError> {
        // handle check for old snapshot being applied
        let index = self.snapshot.get_metadata().get_index();
        let snapshot_index = snapshot.get_metadata().get_index();
        if index >= snapshot_index {
            return Err(StorageError::SnapshotOfDate);
        }
        let mut new_entry = Entry::new();
        new_entry.set_Term(snapshot.get_metadata().get_term());
        new_entry.set_Index(snapshot_index);
        self.snapshot = snapshot;
        self.ents = vec![new_entry];
        Ok(())
    }
// ApplySnapshot overwrites the contents of this Storage object with
// those of the given snapshot.
ApplySnapshot overwrites the contents of this Storage object with
those of the given snapshot.
ApplySnapshot overwrites the contents of this Storage object with those of the given snapshot .
pub fn apply_snapshot(&mut self, snapshot: Snapshot) -> Result<(), StorageError> {
        // handle check for old snapshot being applied
        let index = self.snapshot.get_metadata().get_index();
        let snapshot_index = snapshot.get_metadata().get_index();
        if index >= snapshot_index {
            return Err(StorageError::SnapshotOfDate);
        }
        let mut new_entry = Entry::new();
        new_entry.set_Term(snapshot.get_metadata().get_term());
        new_entry.set_Index(snapshot_index);
        self.snapshot = snapshot;
        self.ents = vec![new_entry];
        Ok(())
    }
pub fn apply_snapshot ( & mut self , snapshot : Snapshot ) -> Result < ( ) , StorageError > { // handle check for old snapshot being applied let index = self . snapshot . get_metadata ( ) . get_index ( ) ; let snapshot_index = snapshot . get_metadata ( ) . get_index ( ) ; if index >= snapshot_index { return Err ( StorageError :: SnapshotOfDate ) ; } let mut new_entry = Entry :: new ( ) ; new_entry . set_Term ( snapshot . get_metadata ( ) . get_term ( ) ) ; new_entry . set_Index ( snapshot_index ) ; self . snapshot = snapshot ; self . ents = vec ! [ new_entry ] ; Ok ( ( ) ) }
ApplySnapshot overwrites the contents of this Storage object with
those of the given snapshot.
ApplySnapshot overwrites the contents of this Storage object with those of the given snapshot .
&mut self
snapshot
Snapshot