ecli_lib/runner/client/
mod.rs1#[cfg(feature = "http-client")]
9pub mod http;
10#[cfg(feature = "native-client")]
12pub mod native;
13
14use crate::{config::ProgramType, error::Result};
15
16use super::{LogEntry, ProgramHandle};
17
18#[derive(Debug, Clone, PartialEq, Eq)]
20pub enum ProgramStatus {
21 Running,
22 Paused,
23}
24#[derive(Debug, Clone)]
26pub struct ProgramDesc {
27 pub id: ProgramHandle,
28 pub name: String,
29 pub status: ProgramStatus,
30}
31#[async_trait::async_trait]
33pub trait AbstractClient {
34 async fn start_program(
35 &self,
36 name: Option<String>,
37 prog_buf: &[u8],
38 prog_type: ProgramType,
39 export_json: bool,
40 args: &[String],
41 btf_archive_path: Option<String>,
42 ) -> Result<ProgramHandle>;
43 async fn terminate_program(&self, handle: ProgramHandle) -> Result<()>;
44 async fn set_program_pause_state(&self, handle: ProgramHandle, pause: bool) -> Result<()>;
45 async fn fetch_logs(
46 &self,
47 handle: ProgramHandle,
48 cursor: Option<usize>,
49 maximum_count: Option<usize>,
50 ) -> Result<Vec<(usize, LogEntry)>>;
51 async fn get_program_list(&self) -> Result<Vec<ProgramDesc>>;
52}