Skip to content
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

Dep: adapt rust stable-1.63 and nightly 2022-08-11 #546

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,15 @@ jobs:


- name: Build | Release Mode | No features
# rust stable 1.63 and nightly 2022-08-11 is incompatible on
# std::error::Error.
# Can not enable feature `bt` on stable anymore.
uses: actions-rs/cargo@v1
with:
command: build
args: --release


- name: Build | Release Mode | No features
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
env:
# Enable unstable feature on stalbe rust.
RUSTC_BOOTSTRAP: 1


- name: Upload artifact
uses: actions/upload-artifact@v2
if: failure()
Expand Down
6 changes: 3 additions & 3 deletions openraft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ repository = "https://github.com/datafuselabs/openraft"
readme = "../README.md"

[dependencies]
anyhow = "1.0.32"
anyerror = { version = "0.1.6", features = ["anyhow"]}
anyhow = "1.0.63"
anyerror = { version = "0.1.7", features = ["anyhow"]}
async-trait = "0.1.36"
byte-unit = "4.0.12"
bytes = "1.0"
Expand All @@ -27,7 +27,7 @@ maplit = "1.0.2"
rand = "0.8"
serde = { version="1", features=["derive"] }
clap = { version = "3.0.7", features = ["derive", "env"] }
thiserror = "1.0.29"
thiserror = "1.0.33"
tokio = { version="1.8", default-features=false, features=["fs", "io-util", "macros", "rt", "rt-multi-thread", "sync", "time"] }
tracing = "0.1.29"
tracing-futures = "0.2.4"
Expand Down
2 changes: 1 addition & 1 deletion openraft/src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::config::error::ConfigError;
/// would cause a leader to send an `InstallSnapshot` RPC to a follower based on replication lag.
///
/// Additional policies may become available in the future.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum SnapshotPolicy {
/// A snapshot will be generated once the log has grown the specified number of logs since
/// the last snapshot.
Expand Down
2 changes: 1 addition & 1 deletion openraft/src/config/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Error variants related to configuration.
#[derive(Debug, thiserror::Error, PartialEq)]
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
#[non_exhaustive]
pub enum ConfigError {
#[error("election timeout: min({min}) must be < max({max})")]
Expand Down
6 changes: 2 additions & 4 deletions openraft/src/core/install_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetwork<D>, S: RaftStorage<D, R>> Ra
// to receive the new snapshot,
// - Mismatched id with offset greater than 0 is an out of order message that should be rejected.
match self.snapshot_state.take() {
None => {
return self.begin_installing_snapshot(req).await;
}
None => self.begin_installing_snapshot(req).await,
Some(SnapshotState::Snapshotting { handle, .. }) => {
handle.abort(); // Abort the current compaction in favor of installation from leader.
return self.begin_installing_snapshot(req).await;
self.begin_installing_snapshot(req).await
}
Some(SnapshotState::Streaming { snapshot, id, offset }) => {
if req.meta.snapshot_id == id {
Expand Down
8 changes: 4 additions & 4 deletions openraft/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(feature = "bt", feature(backtrace))]
#![cfg_attr(feature = "bt", feature(error_generic_member_access))]
#![cfg_attr(feature = "bt", feature(provide_any))]

//! # Feature flags
//!
//! - `bt`: Enable backtrace: generate backtrace for errors. This requires a unstable feature `backtrace` thus it can
//! not be used with stable rust, unless explicity allowing using unstable features in stable rust with
//! `RUSTC_BOOTSTRAP=1`.
//! - `bt`: Enable backtrace: generate backtrace for errors. This requires a unstable feature
//! `error_generic_member_access` and `provde_any` thus it can not be used with stable rust.

mod config;
mod core;
Expand Down
4 changes: 2 additions & 2 deletions openraft/src/types/v070/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::LogId;
use super::Membership;

/// A Raft log entry.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Entry<D: AppData> {
pub log_id: LogId,

Expand All @@ -16,7 +16,7 @@ pub struct Entry<D: AppData> {
}

/// Log entry payload variants.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum EntryPayload<D: AppData> {
/// An empty payload committed by a new cluster leader.
Blank,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2022-01-01
nightly-2022-08-11
1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ imports_granularity = "Item"
group_imports = "StdExternalCrate"
where_single_line = true
trailing_comma = "Vertical"
report_fixme = "Unnumbered"
overflow_delimited_expr = true
wrap_comments = true
comment_width = 120
Expand Down