浏览代码

Add a comment to persister.

Jing Yang 4 年之前
父节点
当前提交
86ac4383ba
共有 1 个文件被更改,包括 5 次插入0 次删除
  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);