Skip to content

Commit

Permalink
Adopt Rust 2018 in raftlog_simu
Browse files Browse the repository at this point in the history
  • Loading branch information
koba-e964 committed Oct 15, 2020
1 parent 6cf821b commit 93b031f
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
1 change: 1 addition & 0 deletions raftlog_simu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
edition = "2018"
name = "raftlog_simu"
version = "0.1.0"
authors = ["The FrugalOS Developers"]
Expand Down
2 changes: 1 addition & 1 deletion raftlog_simu/src/io/configs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! I/O関連の構成設定を集めたモジュール.
use types::{LogicalDuration, Probability, Range};
use crate::types::{LogicalDuration, Probability, Range};

/// `Timer`用の構成設定.
#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
10 changes: 5 additions & 5 deletions raftlog_simu/src/io/deterministic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use raftlog::message::Message;
use raftlog::node::NodeId;
use raftlog::Io;

use io::configs::{ChannelConfig, StorageConfig, TimerConfig};
use io::futures;
use io::{MessageBroker, Storage, Timer};
use types::SharedRng;
use Result;
use crate::io::configs::{ChannelConfig, StorageConfig, TimerConfig};
use crate::io::futures;
use crate::io::{MessageBroker, Storage, Timer};
use crate::types::SharedRng;
use crate::Result;

/// `DeterministicIo`のビルダ.
pub struct DeterministicIoBuilder {
Expand Down
4 changes: 2 additions & 2 deletions raftlog_simu/src/io/futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use futures::{Async, Future, Poll};
use raftlog::election::Ballot;
use raftlog::log::Log;

use types::LogicalDuration;
use Error;
use crate::types::LogicalDuration;
use crate::Error;

pub type Timeout = DelayedResult<(), Error>;
pub type SaveBallot = DelayedResult<(), Error>;
Expand Down
8 changes: 4 additions & 4 deletions raftlog_simu/src/io/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use raftlog::log::{Log, LogIndex, LogPosition, LogPrefix, LogSuffix};
use raftlog::node::NodeId;
use trackable::error::ErrorKindExt;

use io::configs::StorageConfig;
use io::futures::{DelayedResult, LoadBallot, LoadLog, SaveBallot, SaveLog};
use types::SharedRng;
use {ErrorKind, Result};
use crate::io::configs::StorageConfig;
use crate::io::futures::{DelayedResult, LoadBallot, LoadLog, SaveBallot, SaveLog};
use crate::types::SharedRng;
use crate::{ErrorKind, Result};

/// シミュレータ用のストレージ実装.
///
Expand Down
6 changes: 3 additions & 3 deletions raftlog_simu/src/io/timer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use raftlog::election::Role;
use rand::Rng;

use io::configs::TimerConfig;
use io::futures::{DelayedResult, Timeout};
use types::SharedRng;
use crate::io::configs::TimerConfig;
use crate::io::futures::{DelayedResult, Timeout};
use crate::types::SharedRng;

/// シミュレータ用のタイマー実装.
///
Expand Down
6 changes: 3 additions & 3 deletions raftlog_simu/src/io/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::cmp::Ordering;
use std::collections::{BinaryHeap, HashMap};
use std::rc::Rc;

use io::configs::ChannelConfig;
use types::SharedRng;
use Result;
use crate::io::configs::ChannelConfig;
use crate::types::SharedRng;
use crate::Result;

/// シミュレータ用のRPCメッセージブローカー.
///
Expand Down
8 changes: 4 additions & 4 deletions raftlog_simu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ macro_rules! log {
pub use raftlog::{Error, ErrorKind, Result};

#[doc(no_inline)]
pub use io::{DeterministicIo, DeterministicIoBuilder};
pub use logger::Logger;
pub use simulator::Simulator;
pub use simulator_config::SimulatorConfig;
pub use crate::io::{DeterministicIo, DeterministicIoBuilder};
pub use crate::logger::Logger;
pub use crate::simulator::Simulator;
pub use crate::simulator_config::SimulatorConfig;

pub mod io;
pub mod machine;
Expand Down
6 changes: 3 additions & 3 deletions raftlog_simu/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use raftlog::Event;
use std::collections::BTreeMap;
use trackable::error::ErrorKindExt;

use process::Process;
use types::LogicalDuration;
use {DeterministicIoBuilder, Error, ErrorKind, Logger, Result};
use crate::process::Process;
use crate::types::LogicalDuration;
use crate::{DeterministicIoBuilder, Error, ErrorKind, Logger, Result};

/// 状態機械に発行されるコマンド(加算値).
pub type Command = u64;
Expand Down
7 changes: 3 additions & 4 deletions raftlog_simu/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ use raftlog::log::{LogEntry, LogIndex, ProposalId};
use raftlog::message::SequenceNumber;
use raftlog::node::NodeId;
use raftlog::{Event, Io, ReplicatedLog};
use serdeconv;
use std::collections::VecDeque;

use machine::{Command, MachineState};
use types::LogicalDuration;
use {DeterministicIo, Error, ErrorKind, Logger, Result};
use crate::machine::{Command, MachineState};
use crate::types::LogicalDuration;
use crate::{DeterministicIo, Error, ErrorKind, Logger, Result};

/// プロセス.
///
Expand Down
6 changes: 3 additions & 3 deletions raftlog_simu/src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use raftlog::node::NodeId;
use raftlog::Event;
use rand::Rng;

use machine::{MachineState, ReplicatedStateMachine};
use types::SharedRng;
use {DeterministicIoBuilder, ErrorKind, Logger, Result, SimulatorConfig};
use crate::machine::{MachineState, ReplicatedStateMachine};
use crate::types::SharedRng;
use crate::{DeterministicIoBuilder, ErrorKind, Logger, Result, SimulatorConfig};

/// シミュレータ.
pub struct Simulator {
Expand Down
4 changes: 2 additions & 2 deletions raftlog_simu/src/simulator_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use rand::{Rng, SeedableRng, StdRng};
use std::collections::BTreeSet;
use std::time::{SystemTime, UNIX_EPOCH};

use io::IoConfig;
use types::{LogicalDuration, Probability, Range, SharedRng};
use crate::io::IoConfig;
use crate::types::{LogicalDuration, Probability, Range, SharedRng};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SimulatorConfig {
Expand Down

0 comments on commit 93b031f

Please sign in to comment.