use std::sync::Arc;
use chrono::{DateTime, Local};
use serde_json::Value;
use crate::{app::compass::runtimes::InputPluginRuntimes, plugin::input::InputPluginError};
#[derive(Debug, Clone, Default)]
pub struct InputPluginPayload {
pub row: Value,
pub error: Option<Arc<InputPluginError>>,
pub runtimes: InputPluginRuntimes,
}
impl InputPluginPayload {
pub fn new(initial: Value) -> Self {
Self {
row: initial,
error: None,
runtimes: Default::default(),
}
}
pub fn record_input_plugin_runtime(
&mut self,
name: &str,
start_time: DateTime<Local>,
n_results: usize,
) {
self.runtimes.record(name, start_time, n_results);
}
}