parser complete

This commit is contained in:
atagen 2025-09-10 22:39:34 +10:00
commit 8ffd3b9aff
12 changed files with 1321 additions and 0 deletions

12
state/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "nix_build_state"
version = "0.1.0"
edition = "2024"
crate-type = [ "lib" ]
[lib]
path = "./lib.rs"
[dependencies]
serde_json = "1.0.141"
nix_json_parser = { path = "../parser" }

76
state/lib.rs Normal file
View file

@ -0,0 +1,76 @@
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
};
use nix_json_parser::Actions;
pub type Id = u64;
pub enum StorePath {
Downloading,
Uploading,
Downloaded,
Uploaded,
}
pub enum BuildStatus {
Planned,
Running,
Complete,
Failed,
}
pub enum Progress {
JustStarted,
InputReceived,
Finished,
}
pub enum OutputName {
Out,
Doc,
Dev,
Bin,
Info,
Lib,
Man,
Dist,
Other(String),
}
pub enum Host {
Local,
Host(String),
}
pub struct Derivation {
store_path: PathBuf,
}
pub struct BuildInfo {
start: f64,
host: Host,
estimate: Option<u64>,
activity_id: Id,
state: BuildStatus,
}
pub enum DependencyState {
Planned,
Running,
Completed,
}
pub struct Dependencies {
deps: HashMap<Id, BuildInfo>,
}
// #[derive(Default)]
pub struct State {
progress: Progress,
}
impl State {
pub fn imbibe(&mut self, update: Actions) {}
}