src/consensus/util.rs moved to src/util/time.rs, modified corresponding depedencies

This commit is contained in:
aggstam
2022-05-10 16:58:12 +03:00
parent 389208d1da
commit 9b697b525a
9 changed files with 33 additions and 15 deletions

View File

@@ -1,6 +1,9 @@
use crate::{
consensus::{Block, Timestamp},
util::serial::{deserialize, serialize},
consensus::Block,
util::{
serial::{deserialize, serialize},
time::Timestamp,
},
Error, Result,
};

View File

@@ -1,6 +1,9 @@
use crate::{
consensus::{Block, StreamletMetadata, Timestamp},
util::serial::{deserialize, serialize},
consensus::{Block, StreamletMetadata},
util::{
serial::{deserialize, serialize},
time::Timestamp,
},
Error, Result,
};

View File

@@ -3,9 +3,12 @@ use std::io;
use log::debug;
use crate::{
consensus::{Block, BlockInfo, Timestamp},
consensus::{Block, BlockInfo},
impl_vec,
util::serial::{Decodable, Encodable, ReadExt, VarInt, WriteExt},
util::{
serial::{Decodable, Encodable, ReadExt, VarInt, WriteExt},
time::Timestamp,
},
Result,
};

View File

@@ -2,12 +2,15 @@ use std::io;
use log::debug;
use super::{Metadata, StreamletMetadata, Timestamp, BLOCK_VERSION};
use super::{Metadata, StreamletMetadata, BLOCK_VERSION};
use crate::{
crypto::{address::Address, keypair::PublicKey, schnorr::Signature},
impl_vec, net,
tx::Transaction,
util::serial::{serialize, Decodable, Encodable, SerialDecodable, SerialEncodable, VarInt},
util::{
serial::{serialize, Decodable, Encodable, SerialDecodable, SerialEncodable, VarInt},
time::Timestamp,
},
Result,
};

View File

@@ -1,5 +1,8 @@
use super::{Participant, Timestamp, Vote};
use crate::util::serial::{SerialDecodable, SerialEncodable};
use super::{Participant, Vote};
use crate::util::{
serial::{SerialDecodable, SerialEncodable},
time::Timestamp,
};
/// This struct represents additional [`Block`] information used by
/// the consensus protocol

View File

@@ -19,8 +19,7 @@ pub mod state;
pub use state::{ValidatorState, ValidatorStatePtr};
/// Utility functions and types
pub mod util;
pub use util::Timestamp;
use crate::util::time::Timestamp;
/// P2P net protocols
pub mod proto;

View File

@@ -12,8 +12,7 @@ use log::{debug, error, info, warn};
use rand::rngs::OsRng;
use super::{
Block, BlockInfo, BlockProposal, Metadata, Participant, ProposalChain, StreamletMetadata,
Timestamp, Vote,
Block, BlockInfo, BlockProposal, Metadata, Participant, ProposalChain, StreamletMetadata, Vote,
};
use crate::{
blockchain::Blockchain,
@@ -28,7 +27,10 @@ use crate::{
Client, MemoryState, State,
},
tx::Transaction,
util::serial::{serialize, Encodable, SerialDecodable, SerialEncodable},
util::{
serial::{serialize, Encodable, SerialDecodable, SerialEncodable},
time::Timestamp,
},
Result,
};

View File

@@ -9,6 +9,7 @@ pub mod net_name;
pub mod parse;
pub mod path;
pub mod serial;
pub mod time;
#[cfg(feature = "async-runtime")]
pub use async_util::sleep;
@@ -16,3 +17,4 @@ pub use async_util::sleep;
pub use net_name::NetworkName;
pub use parse::{decode_base10, encode_base10};
pub use path::{expand_path, join_config_path, load_keypair_to_str};
pub use time::Timestamp;