pub struct Task {
pub id: String,
pub name: String,
pub category: String,
pub priority: i32,
pub deadline: Option<i64>,
pub release_time: Option<i64>,
pub activities: Vec<Activity>,
pub attributes: HashMap<String, String>,
}Expand description
A task (job) to be scheduled.
Contains one or more activities and scheduling metadata (priority, deadlines). Activities within a task may have precedence constraints forming a DAG.
§Time Representation
All times are in milliseconds relative to a scheduling epoch (t=0). The consumer defines what t=0 means (e.g., shift start, midnight UTC).
Fields§
§id: StringUnique task identifier.
name: StringHuman-readable name.
category: StringTask category (for transition matrix lookups and grouping).
priority: i32Scheduling priority (higher = more important).
deadline: Option<i64>Latest completion time (ms). None = no deadline.
release_time: Option<i64>Earliest start time (ms). None = available immediately.
activities: Vec<Activity>Activities (operations) that compose this task.
attributes: HashMap<String, String>Domain-specific key-value metadata.
Implementations§
Source§impl Task
impl Task
Sourcepub fn with_category(self, category: impl Into<String>) -> Self
pub fn with_category(self, category: impl Into<String>) -> Self
Sets the task category.
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Sets the scheduling priority.
Sourcepub fn with_deadline(self, deadline_ms: i64) -> Self
pub fn with_deadline(self, deadline_ms: i64) -> Self
Sets the deadline (latest completion time in ms).
Sourcepub fn with_release_time(self, release_ms: i64) -> Self
pub fn with_release_time(self, release_ms: i64) -> Self
Sets the release time (earliest start time in ms).
Sourcepub fn with_activity(self, activity: Activity) -> Self
pub fn with_activity(self, activity: Activity) -> Self
Adds an activity to this task.
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds a domain-specific attribute.
Sourcepub fn total_duration_ms(&self) -> i64
pub fn total_duration_ms(&self) -> i64
Total processing duration across all activities (ms).
Sourcepub fn has_activities(&self) -> bool
pub fn has_activities(&self) -> bool
Whether this task has any activities.
Sourcepub fn activity_count(&self) -> usize
pub fn activity_count(&self) -> usize
Number of activities.