From a1a185370da27f2cc3df84d3a8d7141f9ce7db16 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 24 Oct 2021 22:40:08 +0200 Subject: Split defintions used by both runner and executor into separate crate Also get rid of the Runner trait - different runner implementations do not make sense with our current design. --- crates/common/src/types.rs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 crates/common/src/types.rs (limited to 'crates/common/src/types.rs') diff --git a/crates/common/src/types.rs b/crates/common/src/types.rs new file mode 100644 index 0000000..51f9209 --- /dev/null +++ b/crates/common/src/types.rs @@ -0,0 +1,43 @@ +use std::{ + collections::{HashMap, HashSet}, + fmt::Display, +}; + +use serde::{Deserialize, Serialize}; + +use crate::string_hash::*; + +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] +pub struct TaskID { + pub recipe: String, + pub task: String, +} + +impl Display for TaskID { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}:{}", self.recipe, self.task) + } +} + +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] +#[serde(rename_all = "snake_case")] +pub enum Dependency { + Fetch { name: String, sha256: StringHash }, + Task { output: ArchiveHash, path: String }, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Task { + pub label: String, + pub command: String, + pub inherit: Vec, + pub depends: HashSet, + pub outputs: HashMap, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TaskOutput { + pub input_hash: InputHash, + pub layer: Option, + pub outputs: HashMap, +} -- cgit v1.2.3