Add serialization/deseriation support to event log
See bincode and serde_json for usage: https://github.com/TyOverby/bincode Fixes #1
This commit is contained in:
parent
bd84cf6586
commit
fa4e232d73
|
@ -26,4 +26,6 @@ asm = ["sha2-asm"]
|
|||
rayon = "1.0.0"
|
||||
sha2 = "0.7.0"
|
||||
sha2-asm = {version="0.3", optional=true}
|
||||
digest = "0.7.2"
|
||||
generic-array = { version = "0.9.0", default-features = false, features = ["serde"] }
|
||||
serde = "1.0.27"
|
||||
serde_derive = "1.0.27"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#![cfg_attr(feature = "unstable", feature(test))]
|
||||
pub mod log;
|
||||
pub mod historian;
|
||||
extern crate digest;
|
||||
extern crate generic_array;
|
||||
extern crate rayon;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate sha2;
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
/// 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.
|
||||
|
||||
use digest::generic_array::GenericArray;
|
||||
use digest::generic_array::typenum::U32;
|
||||
use generic_array::GenericArray;
|
||||
use generic_array::typenum::U32;
|
||||
pub type Sha256Hash = GenericArray<u8, U32>;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||
pub struct Entry {
|
||||
pub num_hashes: u64,
|
||||
pub end_hash: Sha256Hash,
|
||||
|
@ -29,7 +29,7 @@ pub struct Entry {
|
|||
/// be generated in 'num_hashes' hashes and verified in 'num_hashes' hashes. By logging
|
||||
/// a hash alongside the tick, each tick and be verified in parallel using the 'end_hash'
|
||||
/// of the preceding tick to seed its hashing.
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||
pub enum Event {
|
||||
Tick,
|
||||
UserDataKey(Sha256Hash),
|
||||
|
|
Loading…
Reference in New Issue