mod fetch;
mod liveness;
mod pass;
mod route;
mod sweeps;
pub mod worker;
use super::Roots;
use super::snapshot::Growth;
use crate::binding::Workspace;
use crate::budgets::StepBill;
use crate::git_tree::{GitTree, ProbeStack};
use crate::opslog::OpRow;
use crate::projects::balls::Ball;
use crate::projects::join::JoinRow;
use crate::projects::runner::BlRunner;
use crate::state::{DirtySet, SnapshotCell, WatchSetHandle, new_watchset};
use crate::ui_state::Clock;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
pub struct Deriver {
roots: Roots,
clock: Arc<dyn Clock>,
probes: ProbeStack,
pub(super) watches: WatchSetHandle,
dirty: DirtySet,
schedule: super::dirty::Schedule,
pub(super) cadence: super::Cadence,
pub(super) fleet: std::collections::BTreeMap<String, crate::fleet::Policy>,
cell: SnapshotCell,
balls: Box<dyn BlRunner>,
pub(super) projects: Vec<PathBuf>,
pub(super) workspaces: Vec<Workspace>,
pub(super) trees: HashMap<PathBuf, GitTree>,
pub(super) bills: HashMap<PathBuf, Vec<StepBill>>,
pub(super) windows: std::collections::BTreeMap<String, u64>,
pub(super) balls_by_project: HashMap<PathBuf, Vec<Ball>>,
pub(super) closed_by_project: HashMap<PathBuf, Vec<Ball>>,
pub(super) join_rows: Vec<JoinRow>,
pub(super) ops: Vec<OpRow>,
pub(super) changed: bool,
late: bool,
growth: Vec<Growth>,
ui_bytes: Option<Vec<u8>>,
}
impl Deriver {
pub(super) fn new(
roots: Roots,
clock: Arc<dyn Clock>,
balls: Box<dyn BlRunner>,
dirty: DirtySet,
cell: SnapshotCell,
) -> Self {
let cadence = super::Cadence::default();
let schedule = super::dirty::Schedule::new(Arc::clone(&clock), cadence);
Self {
roots,
clock,
probes: ProbeStack::platform(),
watches: new_watchset(),
dirty,
schedule,
cadence,
fleet: std::collections::BTreeMap::new(),
cell,
balls,
projects: Vec::new(),
workspaces: Vec::new(),
trees: HashMap::new(),
bills: HashMap::new(),
windows: std::collections::BTreeMap::new(),
balls_by_project: HashMap::new(),
closed_by_project: HashMap::new(),
join_rows: Vec::new(),
ops: Vec::new(),
changed: false,
late: false,
growth: Vec::new(),
ui_bytes: None,
}
}
pub fn watchset_handle(&self) -> WatchSetHandle {
Arc::clone(&self.watches)
}
pub fn dirty_handle(&self) -> DirtySet {
self.dirty.clone()
}
}