From 2aefbf627f243dd261b7585ef1250d32efd9dfe7 Mon Sep 17 00:00:00 2001 From: Bisheng Huang Date: Wed, 15 May 2024 18:36:07 +0800 Subject: [PATCH] Fix typos in code comments (#545) Signed-off-by: Bisheng Huang --- examples/five_mem_node/main.rs | 2 +- src/raw_node.rs | 4 ++-- src/storage.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/five_mem_node/main.rs b/examples/five_mem_node/main.rs index e825adb0..b16c2936 100644 --- a/examples/five_mem_node/main.rs +++ b/examples/five_mem_node/main.rs @@ -105,7 +105,7 @@ fn main() { &logger, ); - // Check control signals from + // Check control signals from the main thread. if check_signals(&rx_stop_clone) { return; }; diff --git a/src/raw_node.rs b/src/raw_node.rs index da2240ca..55b28696 100644 --- a/src/raw_node.rs +++ b/src/raw_node.rs @@ -350,7 +350,7 @@ impl RawNode { self.raft.step(m) } - /// Propose proposes data be appended to the raft log. + /// Propose proposes data to be appended to the raft log. pub fn propose(&mut self, context: Vec, data: Vec) -> Result<()> { let mut m = Message::default(); m.set_msg_type(MessageType::MsgPropose); @@ -647,7 +647,7 @@ impl RawNode { /// committed entries, send all messages. /// /// Returns the LightReady that contains commit index, committed entries and messages. [`LightReady`] - /// contains updates that only valid after persisting last ready. It should also be fully processed. + /// contains updates that are only valid after persisting last ready. It should also be fully processed. /// Then [`Self::advance_apply`] or [`Self::advance_apply_to`] should be used later to update applying /// progress. pub fn advance(&mut self, rd: Ready) -> LightReady { diff --git a/src/storage.rs b/src/storage.rs index ea013b4b..288501e0 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -154,7 +154,7 @@ pub trait Storage { /// If snapshot is temporarily unavailable, it should return SnapshotTemporarilyUnavailable, /// so raft state machine could know that Storage needs some time to prepare /// snapshot and call snapshot later. - /// A snapshot's index must not less than the `request_index`. + /// A snapshot's index must not be less than the `request_index`. /// `to` indicates which peer is requesting the snapshot. fn snapshot(&self, request_index: u64, to: u64) -> Result; } @@ -373,7 +373,7 @@ impl MemStorageCore { /// `MemStorage` is a thread-safe but incomplete implementation of `Storage`, mainly for tests. /// /// A real `Storage` should save both raft logs and applied data. However `MemStorage` only -/// contains raft logs. So you can call `MemStorage::append` to persist new received unstable raft +/// contains raft logs. So you can call `MemStorage::append` to persist newly received unstable raft /// logs and then access them with `Storage` APIs. The only exception is `Storage::snapshot`. There /// is no data in `Snapshot` returned by `MemStorage::snapshot` because applied data is not stored /// in `MemStorage`.