-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix clippy #553
fix: fix clippy #553
Changes from 5 commits
9a2374a
88e5f46
b28e899
465c5cd
baeae3a
ffe7c9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,7 @@ The `Ready` state contains quite a bit of information, and you need to check and | |
by one: | ||
|
||
1. Check whether `messages` is empty or not. If not, it means that the node will send messages to | ||
other nodes: | ||
other nodes: | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -226,7 +226,7 @@ other nodes: | |
``` | ||
|
||
2. Check whether `snapshot` is empty or not. If not empty, it means that the Raft node has received | ||
a Raft snapshot from the leader and we must apply the snapshot: | ||
a Raft snapshot from the leader and we must apply the snapshot: | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -254,8 +254,8 @@ a Raft snapshot from the leader and we must apply the snapshot: | |
``` | ||
|
||
3. Check whether `committed_entries` is empty or not. If not, it means that there are some newly | ||
committed log entries which you must apply to the state machine. Of course, after applying, you | ||
need to update the applied index and resume `apply` later: | ||
committed log entries which you must apply to the state machine. Of course, after applying, you | ||
need to update the applied index and resume `apply` later: | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -310,7 +310,7 @@ need to update the applied index and resume `apply` later: | |
after restarting, *it may work but potential log loss may also be ignored silently*. | ||
|
||
4. Check whether `entries` is empty or not. If not empty, it means that there are newly added | ||
entries but have not been committed yet, we must append the entries to the Raft log: | ||
entries but have not been committed yet, we must append the entries to the Raft log: | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -335,8 +335,8 @@ entries but have not been committed yet, we must append the entries to the Raft | |
``` | ||
|
||
5. Check whether `hs` is empty or not. If not empty, it means that the `HardState` of the node has | ||
changed. For example, the node may vote for a new leader, or the commit index has been increased. | ||
We must persist the changed `HardState`: | ||
changed. For example, the node may vote for a new leader, or the commit index has been increased. | ||
We must persist the changed `HardState`: | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -360,7 +360,7 @@ We must persist the changed `HardState`: | |
``` | ||
|
||
6. Check whether `persisted_messages` is empty or not. If not, it means that the node will send messages to | ||
other nodes after persisting hardstate, entries and snapshot: | ||
other nodes after persisting hardstate, entries and snapshot: | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -385,8 +385,8 @@ other nodes after persisting hardstate, entries and snapshot: | |
``` | ||
|
||
7. Call `advance` to notify that the previous work is completed. Get the return value `LightReady` | ||
and handle its `messages` and `committed_entries` like step 1 and step 3 does. Then call `advance_apply` | ||
to advance the applied index inside. | ||
and handle its `messages` and `committed_entries` like step 1 and step 3 does. Then call `advance_apply` | ||
to advance the applied index inside. | ||
|
||
```rust | ||
# use slog::{Drain, o}; | ||
|
@@ -469,7 +469,7 @@ node.propose_conf_change(vec![], cc).unwrap(); | |
This process is a two-phase process, during the midst of it the peer group's leader is managing | ||
**two independent, possibly overlapping peer sets**. | ||
|
||
> **Note:** In order to maintain resiliency guarantees (progress while a majority of both peer sets is | ||
\> **Note:** In order to maintain resiliency guarantees (progress while a majority of both peer sets is | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why escape this? |
||
active), it is recommended to wait until the entire peer group has exited the transition phase | ||
before taking old, removed peers offline. | ||
|
||
|
@@ -571,6 +571,7 @@ pub mod prelude { | |
/// | ||
/// Currently, this is a `log` adaptor behind a `Once` to ensure there is no clobbering. | ||
#[cfg(any(test, feature = "default-logger"))] | ||
#[allow(static_mut_refs)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, I have updated the PR. |
||
pub fn default_logger() -> slog::Logger { | ||
use slog::{o, Drain}; | ||
use std::sync::{Mutex, Once}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
use std::fmt; | ||
use std::fmt::Write; | ||
use std::u64; | ||
|
||
use slog::{OwnedKVList, Record, KV}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about changing it with
if let Some(rb) = &mut self.rewrite_buffer
?