From 9f9b79f30b40960b7be1fd213e0eb899aa9bed8e Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Mon, 19 Mar 2018 10:09:17 -0600 Subject: [PATCH] log -> ledger Free up namespace for traditional runtime logs. --- src/bin/historian-demo.rs | 6 +++--- src/historian.rs | 4 ++-- src/{log.rs => ledger.rs} | 8 ++++---- src/lib.rs | 2 +- src/mint.rs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename src/{log.rs => ledger.rs} (93%) diff --git a/src/bin/historian-demo.rs b/src/bin/historian-demo.rs index 1ac5ae231..8708e74c7 100644 --- a/src/bin/historian-demo.rs +++ b/src/bin/historian-demo.rs @@ -3,7 +3,7 @@ extern crate silk; use silk::historian::Historian; use silk::hash::Hash; use silk::entry::Entry; -use silk::log::verify_slice; +use silk::ledger::verify_slice; use silk::logger::Signal; use silk::signature::{KeyPair, KeyPairUtil}; use silk::transaction::Transaction; @@ -12,7 +12,7 @@ use std::thread::sleep; use std::time::Duration; use std::sync::mpsc::SendError; -fn create_log(hist: &Historian, seed: &Hash) -> Result<(), SendError> { +fn create_ledger(hist: &Historian, seed: &Hash) -> Result<(), SendError> { sleep(Duration::from_millis(15)); let keypair = KeyPair::new(); let tr = Transaction::new(&keypair, keypair.pubkey(), 42, *seed); @@ -25,7 +25,7 @@ fn create_log(hist: &Historian, seed: &Hash) -> Result<(), SendError> { fn main() { let seed = Hash::default(); let hist = Historian::new(&seed, Some(10)); - create_log(&hist, &seed).expect("send error"); + create_ledger(&hist, &seed).expect("send error"); drop(hist.sender); let entries: Vec = hist.receiver.iter().collect(); for entry in &entries { diff --git a/src/historian.rs b/src/historian.rs index 77e9f35a5..9c16dc710 100644 --- a/src/historian.rs +++ b/src/historian.rs @@ -67,7 +67,7 @@ pub fn reserve_signature(sigs: &mut HashSet, sig: &Signature) -> bool #[cfg(test)] mod tests { use super::*; - use log::*; + use ledger::*; use std::thread::sleep; use std::time::Duration; @@ -132,7 +132,7 @@ mod tests { assert_eq!(entries.len(), 1); // Ensure the ID is not the seed, which indicates another Tick - // was logged before the one we sent. + // was recorded before the one we sent. assert_ne!(entries[0].id, zero); } } diff --git a/src/log.rs b/src/ledger.rs similarity index 93% rename from src/log.rs rename to src/ledger.rs index 058e5eaa2..21dfd7827 100644 --- a/src/log.rs +++ b/src/ledger.rs @@ -1,7 +1,7 @@ -//! The `log` crate provides the foundational data structures for Proof-of-History, +//! The `ledger` crate provides the foundational data structures for Proof-of-History, //! an ordered log of events in time. -/// Each log entry contains three pieces of data. The 'num_hashes' field is the number +/// Each entry contains three pieces of data. The 'num_hashes' field is the number /// of hashes performed since the previous entry. The 'id' field is the result /// of hashing 'id' from the previous entry 'num_hashes' times. The 'event' /// field points to an Event that took place shortly after 'id' was generated. @@ -11,7 +11,7 @@ /// over time, one should expect the duration 'num_hashes' represents to decrease proportionally. /// Though processing power varies across nodes, the network gives priority to the /// fastest processor. Duration should therefore be estimated by assuming that the hash -/// was generated by the fastest processor at the time the entry was logged. +/// was generated by the fastest processor at the time the entry was recorded. use hash::Hash; use entry::{next_tick, Entry}; @@ -60,7 +60,7 @@ mod tests { mod bench { extern crate test; use self::test::Bencher; - use log::*; + use ledger::*; #[bench] fn event_bench(bencher: &mut Bencher) { diff --git a/src/lib.rs b/src/lib.rs index 089399a5e..7af181679 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ pub mod plan; pub mod transaction; pub mod event; pub mod entry; -pub mod log; +pub mod ledger; pub mod mint; pub mod logger; pub mod historian; diff --git a/src/mint.rs b/src/mint.rs index 2040b0948..f2a91da87 100644 --- a/src/mint.rs +++ b/src/mint.rs @@ -57,7 +57,7 @@ impl Mint { #[cfg(test)] mod tests { use super::*; - use log::verify_slice; + use ledger::verify_slice; use plan::{Action, Plan}; #[test]