Rename event crate to log
This commit is contained in:
parent
471f036444
commit
fd209ef1a9
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use std::thread::JoinHandle;
|
use std::thread::JoinHandle;
|
||||||
use std::sync::mpsc::{Receiver, Sender};
|
use std::sync::mpsc::{Receiver, Sender};
|
||||||
use event::{Entry, Event};
|
use log::{Entry, Event};
|
||||||
|
|
||||||
pub struct Historian {
|
pub struct Historian {
|
||||||
pub sender: Sender<Event>,
|
pub sender: Sender<Event>,
|
||||||
|
@ -100,7 +100,7 @@ impl Historian {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use event::*;
|
use log::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_historian() {
|
fn test_historian() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![cfg_attr(feature = "unstable", feature(test))]
|
#![cfg_attr(feature = "unstable", feature(test))]
|
||||||
pub mod event;
|
pub mod log;
|
||||||
pub mod historian;
|
pub mod historian;
|
||||||
extern crate itertools;
|
extern crate itertools;
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
//! The `event` crate provides the foundational data structures for Proof-of-History
|
//! The `log` crate provides the foundational data structures for Proof-of-History,
|
||||||
|
//! an ordered log of events in time.
|
||||||
|
|
||||||
/// A Proof-of-History is an ordered log of events in time. Each entry contains three
|
/// Each log entry contains three pieces of data. The 'num_hashes' field is the number
|
||||||
/// pieces of data. The 'num_hashes' field is the number of hashes performed since the previous
|
/// of hashes performed since the previous entry. The 'end_hash' field is the result
|
||||||
/// entry. The 'end_hash' field is the result of hashing 'end_hash' from the previous entry
|
/// of hashing 'end_hash' from the previous entry 'num_hashes' times. The 'event'
|
||||||
/// 'num_hashes' times. The 'event' field points to an Event that took place shortly
|
/// field points to an Event that took place shortly after 'end_hash' was generated.
|
||||||
/// after 'end_hash' was generated.
|
|
||||||
///
|
///
|
||||||
/// If you divide 'num_hashes' by the amount of time it takes to generate a new hash, you
|
/// If you divide 'num_hashes' by the amount of time it takes to generate a new hash, you
|
||||||
/// get a duration estimate since the last event. Since processing power increases
|
/// get a duration estimate since the last event. Since processing power increases
|
||||||
|
@ -131,23 +131,23 @@ mod tests {
|
||||||
mod bench {
|
mod bench {
|
||||||
extern crate test;
|
extern crate test;
|
||||||
use self::test::Bencher;
|
use self::test::Bencher;
|
||||||
use event;
|
use log::*;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn event_bench(bencher: &mut Bencher) {
|
fn event_bench(bencher: &mut Bencher) {
|
||||||
let start_hash = 0;
|
let start_hash = 0;
|
||||||
let events = event::create_ticks(start_hash, 100_000, 8);
|
let events = create_ticks(start_hash, 100_000, 8);
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
assert!(event::verify_slice(&events, start_hash));
|
assert!(verify_slice(&events, start_hash));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn event_bench_seq(bencher: &mut Bencher) {
|
fn event_bench_seq(bencher: &mut Bencher) {
|
||||||
let start_hash = 0;
|
let start_hash = 0;
|
||||||
let events = event::create_ticks(start_hash, 100_000, 8);
|
let events = create_ticks(start_hash, 100_000, 8);
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
assert!(event::verify_slice_seq(&events, start_hash));
|
assert!(verify_slice_seq(&events, start_hash));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue