diff --git a/async-raft/src/storage.rs b/async-raft/src/storage.rs index 2b616f6..2086c6e 100644 --- a/async-raft/src/storage.rs +++ b/async-raft/src/storage.rs @@ -83,6 +83,9 @@ where R: AppDataResponse, { /// The storage engine's associated type used for exposing a snapshot for reading & writing. + /// + /// See the [storage chapter of the guide](https://async-raft.github.io/async-raft/storage.html) + /// for details on where and how this is used. type Snapshot: AsyncRead + AsyncWrite + AsyncSeek + Send + Unpin + 'static; /// The error type used to indicate to Raft that shutdown is needed when calling the /// `apply_entry_to_state_machine` method. diff --git a/guide/src/storage.md b/guide/src/storage.md index b4d277c..afa53f2 100644 --- a/guide/src/storage.md +++ b/guide/src/storage.md @@ -13,7 +13,7 @@ Once you're ready to begin with your implementation, be sure to adhere to the do For inspiration, have a look at this [repo's `memstore` project](https://github.com/async-raft/async-raft/tree/master/memstore). It is an in-memory implementation of the `RaftStorage` trait, intended for demo and testing purposes. ### compaction / snapshots -This implementation of Raft automatically triggers log compaction based on runtime configuration, using the [`RaftStorage::do_log_compaction`](https://docs.rs/async-raft/latest/async_raft/storage/trait.RaftStorage.html#tymethod.do_log_compaction) method. Everything related to compaction / snapshots starts with this method. Though snapshots are originally created in the [`RaftStorage::do_log_compaction`](https://docs.rs/async-raft/latest/async_raft/storage/trait.RaftStorage.html#tymethod.do_log_compaction) method, the Raft cluster leader may stream a snapshot over to other nodes if the node is new and needs to be brought up-to-speed, or if a node is lagging behind. +This implementation of Raft automatically triggers log compaction based on runtime configuration, using the [`RaftStorage::do_log_compaction`](https://docs.rs/async-raft/latest/async_raft/storage/trait.RaftStorage.html#tymethod.do_log_compaction) method. Everything related to compaction / snapshots starts with this method. Though snapshots are originally created in the [`RaftStorage::do_log_compaction`](https://docs.rs/async-raft/latest/async_raft/storage/trait.RaftStorage.html#tymethod.do_log_compaction) method, the Raft cluster leader may stream a snapshot over to other nodes if the node is new and needs to be brought up-to-speed, or if a node is lagging behind. Internally, Raft uses the `RaftStorage::Snapshot` associated type to work with the snapshot locally and for streaming to follower nodes. Compaction / snapshotting are not optional in this system. It is an integral component of the Raft spec, and `RaftStorage` implementations should be careful to implement the compaction / snapshotting related methods carefully according to the trait's documentation.