log -> ledger

Free up namespace for traditional runtime logs.
This commit is contained in:
Greg Fitzgerald 2018-03-19 10:09:17 -06:00
parent 265f41887f
commit 9f9b79f30b
5 changed files with 11 additions and 11 deletions

View File

@ -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<Signal>> {
fn create_ledger(hist: &Historian, seed: &Hash) -> Result<(), SendError<Signal>> {
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<Signal>> {
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<Entry> = hist.receiver.iter().collect();
for entry in &entries {

View File

@ -67,7 +67,7 @@ pub fn reserve_signature(sigs: &mut HashSet<Signature>, 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);
}
}

View File

@ -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) {

View File

@ -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;

View File

@ -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]