use clasp_core::{SignalType, Value};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JournalEntry {
pub seq: u64,
pub timestamp: u64,
pub author: String,
pub address: String,
pub signal_type: SignalType,
pub value: Value,
pub revision: Option<u64>,
pub msg_type: u8,
}
impl JournalEntry {
pub fn from_set(
address: String,
value: Value,
revision: u64,
author: String,
timestamp: u64,
) -> Self {
Self {
seq: 0, timestamp,
author,
address,
signal_type: SignalType::Param,
value,
revision: Some(revision),
msg_type: 0x21, }
}
pub fn from_publish(
address: String,
signal_type: SignalType,
value: Value,
author: String,
timestamp: u64,
) -> Self {
Self {
seq: 0, timestamp,
author,
address,
signal_type,
value,
revision: None,
msg_type: 0x20, }
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ParamSnapshot {
pub address: String,
pub value: Value,
pub revision: u64,
pub writer: String,
pub timestamp: u64,
}