Docs cleanup
This commit is contained in:
parent
a857ae514b
commit
1c2e0af69b
18
src/event.rs
18
src/event.rs
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
/// A Proof-of-History is an ordered log of events in time. Each entry contains three
|
/// A Proof-of-History is an ordered log of events in time. Each entry contains three
|
||||||
/// pieces of data. The 'num_hashes' field is the number of hashes performed since the previous
|
/// pieces of data. The 'num_hashes' field is the number of hashes performed since the previous
|
||||||
/// entry. The 'hash' field is the result of hashing 'hash' from the previous entry 'num_hashes'
|
/// entry. The 'end_hash' field is the result of hashing 'end_hash' from the previous entry
|
||||||
/// times. The 'data' field is an optional foreign key (a hash) pointing to some arbitrary
|
/// 'num_hashes' times. The 'data' field is an optional foreign key (a hash) pointing to some
|
||||||
/// data that a client is looking to associate with the entry.
|
/// arbitrary data that a client is looking to associate with the entry.
|
||||||
///
|
///
|
||||||
/// 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
|
||||||
|
@ -18,11 +18,11 @@ pub struct Event {
|
||||||
pub data: EventData,
|
pub data: EventData,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When 'data' is Tick, the event represents a simple "tick", and exists for the
|
/// When 'data' is Tick, the event represents a simple clock tick, and exists for the
|
||||||
/// sole purpose of improving the performance of event log verification. A tick can
|
/// sole purpose of improving the performance of event log verification. A tick can
|
||||||
/// be generated in 'num_hashes' hashes and verified in 'num_hashes' hashes. By logging a hash alongside
|
/// be generated in 'num_hashes' hashes and verified in 'num_hashes' hashes. By logging
|
||||||
/// the tick, each tick and be verified in parallel using the 'end_hash' of the preceding
|
/// a hash alongside the tick, each tick and be verified in parallel using the 'end_hash'
|
||||||
/// tick to seed its hashing.
|
/// of the preceding tick to seed its hashing.
|
||||||
pub enum EventData {
|
pub enum EventData {
|
||||||
Tick,
|
Tick,
|
||||||
UserDataKey(u64),
|
UserDataKey(u64),
|
||||||
|
@ -134,9 +134,9 @@ mod bench {
|
||||||
#[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, 4);
|
let events = event::create_ticks(start_hash, 100_000, 8);
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
assert!(event::verify_slice(&events, start_hash));
|
assert!(event::verify_slice_seq(&events, start_hash));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue