use crate::contract::capability::FsAccess;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum HostControl {
LaunchWorkload,
CaptureStreams {
streams: StdStreams,
},
TempRoot {
visibility: PathView,
},
ExposePath {
source: String,
dest: String,
access: FsAccess,
view: PathView,
},
CommitArtifact {
durability: CommitDurability,
},
DiscardArtifact,
Kill {
target: KillTarget,
guarantee: KillGuarantee,
},
ListOutputs,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum PathView {
PrivateToBoundary,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum CommitDurability {
Atomic,
Durable,
BestEffortDurable,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum KillTarget {
RunTree,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum KillGuarantee {
Atomic,
BestEffortAllowed,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct StdStreams {
pub stdout: bool,
pub stderr: bool,
pub stdin: bool,
}
impl StdStreams {
#[must_use]
pub fn capture_out_err() -> Self {
Self {
stdout: true,
stderr: true,
stdin: false,
}
}
}