use std::path::PathBuf;
use rill_lang::ir::ProbeId;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum AnalyzerCommand {
SetBreakpoint {
probe_id: ProbeId,
},
ClearBreakpoint {
probe_id: ProbeId,
},
Continue,
Step,
GetProbeValue {
probe_id: ProbeId,
},
GetProbeValues,
ListNodes,
ListProbes,
ListCommands,
EnableProbe {
probe_id: ProbeId,
},
DisableProbe {
probe_id: ProbeId,
},
Pause,
ListAutomatons,
GetAutomatonState {
name: String,
},
ListSensors,
GetSensorStatus {
name: String,
},
ListQueues,
Quit,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum AnalyzerResponse {
Ok,
ProbeValue {
probe_id: ProbeId,
value_bits: u64,
},
ProbeValues(Vec<(ProbeId, u64)>),
NodeList(Vec<NodeInfo>),
ProbeList(Vec<ProbeInfo>),
CommandLog(Vec<CommandLogEntry>),
Error(String),
AutomatonsList(Vec<String>),
AutomatonState(String),
SensorList(Vec<String>),
SensorStatus(String),
QueueList(Vec<QueueStats>),
Paused,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NodeInfo {
pub name: String,
pub node_type: String,
pub num_inputs: usize,
pub num_outputs: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProbeInfo {
pub probe_id: ProbeId,
pub name: String,
pub node_name: String,
pub enabled: bool,
pub has_breakpoint: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommandLogEntry {
pub block_index: u64,
pub command_kind: String,
pub node_name: String,
pub param_name: Option<String>,
pub value_repr: String,
}
#[derive(Debug, Clone)]
pub struct AnalyzerConfig {
pub output: OutputMode,
pub log_file: Option<PathBuf>,
}
impl Default for AnalyzerConfig {
fn default() -> Self {
Self {
output: OutputMode::Text,
log_file: None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum OutputMode {
Text,
Json,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueueStats {
pub name: String,
pub capacity: usize,
pub len: usize,
pub is_full: bool,
}