use sim_incremental_core::ContinuationToken;
use super::{CalcLimits, RequestId};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct AutomaticBudget {
pub max_requests: usize,
pub limits: CalcLimits,
}
impl AutomaticBudget {
#[must_use]
pub const fn new(max_requests: usize, limits: CalcLimits) -> Self {
Self {
max_requests,
limits,
}
}
}
impl Default for AutomaticBudget {
fn default() -> Self {
Self::new(16, CalcLimits::default())
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct AutomaticContinuation {
generation: u64,
}
impl AutomaticContinuation {
pub(super) const fn new(generation: u64) -> Self {
Self { generation }
}
#[must_use]
pub const fn generation(self) -> u64 {
self.generation
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct QueuedCalculation {
pub request_id: RequestId,
pub cell: String,
pub ready_at_ms: u64,
pub priority: i16,
pub sequence: u64,
pub bypasses: u8,
pub incremental_continuation: Option<ContinuationToken>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AutomaticQueueSnapshot {
pub generation: u64,
pub next_sequence: u64,
pub entries: Vec<QueuedCalculation>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AutomaticRun {
pub completed: Vec<RequestId>,
pub budget_exhausted: Vec<RequestId>,
pub continuation: Option<AutomaticContinuation>,
}
pub(super) const MAX_READY_BYPASSES: u8 = 3;