Explorar o código

Add a comment to persister.

Jing Yang %!s(int64=4) %!d(string=hai) anos
pai
achega
86ac4383ba
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      src/persister.rs

+ 5 - 0
src/persister.rs

@@ -7,6 +7,11 @@ use serde::Serialize;
 use crate::log_array::LogArray;
 use crate::{Peer, RaftState, Term};
 
+/// An object that saves bytes to permanent storage.
+///
+/// When the methods of this trait returns, data should have been persisted to
+/// the storage. These methods should never return failure except panicking.
+/// They should not block forever, either.
 pub trait Persister: Send + Sync {
     fn read_state(&self) -> Bytes;
     fn save_state(&self, bytes: Bytes);