use super::*;
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, PartialEq)]
pub struct PrewarmContextKey {
#[get(type(copy))]
pub(crate) resource_version: u64,
#[get(type(copy))]
pub(crate) theme_mode: ThemeMode,
#[get(type(copy))]
pub(crate) dpr_bits: u32,
#[get(type(copy))]
pub(crate) locale_hash: u64,
}
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct RoutePrewarmTask {
pub(crate) route_key: String,
#[get(type(copy))]
pub(crate) kind: PrewarmWorkKind,
#[get(type(copy))]
pub(crate) context: PrewarmContextKey,
#[get(type(copy))]
pub(crate) estimated_bytes: usize,
#[get(type(copy))]
pub(crate) estimated_us: u64,
#[get(type(copy))]
pub(crate) priority: u8,
pub(crate) sample_text: String,
}
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct PrewarmedRouteArtifact {
pub(crate) route_key: String,
#[get(type(copy))]
pub(crate) context: PrewarmContextKey,
#[get(type(copy))]
pub(crate) completed_work_mask: u8,
#[get(type(copy))]
pub(crate) resident_bytes: usize,
#[get(type(copy))]
pub(crate) prepared_items: usize,
}
#[derive(Clone, Data, Debug)]
pub struct RoutePrewarmer {
#[get(type(copy))]
pub(crate) max_pending_tasks: usize,
#[get(type(copy))]
pub(crate) max_memory_bytes: usize,
#[get(type(copy))]
pub(crate) max_upload_bytes_per_frame: usize,
#[get(type(copy))]
pub(crate) default_step_budget_us: u64,
#[get(type(copy))]
pub(crate) active_context: PrewarmContextKey,
#[get(type(copy))]
pub(crate) enabled: bool,
pub(crate) pending: Vec<RoutePrewarmTask>,
pub(crate) ready: Vec<PrewarmedRouteArtifact>,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) resident_bytes: usize,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) enqueued_count: u64,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) executed_tasks: u64,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) cancelled_tasks: u64,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) invalidated_artifacts: u64,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) budget_deferrals: u64,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) preempted_until_idle: bool,
#[get(type(copy))]
#[get_mut(skip)]
#[set(skip)]
pub(crate) idle_slices_executed: u64,
}
#[derive(CustomDebug)]
pub struct BackgroundTask<T> {
pub(crate) ready: Arc<AtomicBool>,
#[debug(skip)]
pub(crate) slot: Arc<Mutex<Option<T>>>,
}