eryon-mem 0.0.4

this crate implements the memory-related aspects of the eryon framework
/*
    Appellation: records <module>
    Contrib: @FL03
*/
use super::TransactionKind;
use scsys::{Id, Timestamp};

#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(
    feature = "serde",
    derive(serde_derive::Deserialize, serde_derive::Serialize),
    serde(rename_all = "snake_case")
)]
pub struct Transaction {
    pub(crate) id: Id,
    pub(crate) hash: String,
    pub(crate) kind: TransactionKind,
    pub(crate) nodes: usize,
    pub(crate) created_at: Timestamp,
}

impl Transaction {
    pub fn new(hash: String, nodes: usize, kind: TransactionKind) -> Self {
        Self {
            id: Id::atomic(),
            hash,
            kind,
            nodes,
            created_at: Timestamp::now(),
        }
    }
}