pub fn sync(&mut self) -> io::Result<()> {
		// truncating the storage file if a rewind occurred
		let record_len = 32 + T::sum_len() as u64;
		if let Some((pos, _, _)) = self.rewind {
			self.hashsum_file.truncate(pos * record_len)?;
		}

		for elem in &self.buffer.elems {
			let res = if let Some(ref hs) = *elem {
				self.hashsum_file.append(&ser::ser_vec(&hs).unwrap()[..])
			} else {
				// the element has alredy been pruned in the buffer, we just insert
				// zeros until compaction to avoid wrong hashum store offsets 
				self.hashsum_file.append(&vec![0; record_len as usize])
			};

			if let Err(e) = res {
				return Err(io::Error::new(
					io::ErrorKind::Interrupted,
					format!("Could not write to log storage, disk full? {:?}", e),
				));
			}
		}

		self.buffer_index = self.buffer_index + self.buffer.len();
		self.buffer.clear();
		self.remove_log.flush()?;
		self.hashsum_file.sync()?;
		self.rewind = None;
		Ok(())
	}
/// Syncs all files to disk. A call to sync is required to ensure all the
/// data has been successfully written to disk.
Syncs all files to disk. A call to sync is required to ensure all the
data has been successfully written to disk.
Syncs all files to disk . A call to sync is required to ensure all the data has been successfully written to disk .
pub fn sync(&mut self) -> io::Result<()> {
		// truncating the storage file if a rewind occurred
		let record_len = 32 + T::sum_len() as u64;
		if let Some((pos, _, _)) = self.rewind {
			self.hashsum_file.truncate(pos * record_len)?;
		}
		for elem in &self.buffer.elems {
			let res = if let Some(ref hs) = *elem {
				self.hashsum_file.append(&ser::ser_vec(&hs).unwrap()[..])
			} else {
				// the element has alredy been pruned in the buffer, we just insert
				// zeros until compaction to avoid wrong hashum store offsets 
				self.hashsum_file.append(&vec![0; record_len as usize])
			};
			if let Err(e) = res {
				return Err(io::Error::new(
					io::ErrorKind::Interrupted,
					format!("Could not write to log storage, disk full? {:?}", e),
				));
			}
		}
		self.buffer_index = self.buffer_index + self.buffer.len();
		self.buffer.clear();
		self.remove_log.flush()?;
		self.hashsum_file.sync()?;
		self.rewind = None;
		Ok(())
	}
pub fn sync ( & mut self ) -> io :: Result < ( ) > { // truncating the storage file if a rewind occurred let record_len = 32 + T :: sum_len ( ) as u64 ; if let Some ( ( pos , _ , _ ) ) = self . rewind { self . hashsum_file . truncate ( pos * record_len ) ? ; } for elem in & self . buffer . elems { let res = if let Some ( ref hs ) = * elem { self . hashsum_file . append ( & ser :: ser_vec ( & hs ) . unwrap ( ) [ .. ] ) } else { // the element has alredy been pruned in the buffer, we just insert // zeros until compaction to avoid wrong hashum store offsets  self . hashsum_file . append ( & vec ! [ 0 record_len as usize ] ) } ; if let Err ( e ) = res { return Err ( io :: Error :: new ( io :: ErrorKind :: Interrupted , format ! ( " " e ) , ) ) ; } } self . buffer_index = self . buffer_index + self . buffer . len ( ) ; self . buffer . clear ( ) ; self . remove_log . flush ( ) ? ; self . hashsum_file . sync ( ) ? ; self . rewind = None ; Ok ( ( ) ) }
Syncs all files to disk.
Syncs all files to disk .
&mut self