pub struct PendingTask<S: State> {
pub id: String,
pub node_name: String,
pub trigger: TaskTrigger,
pub state_override: Option<S>,
pub state_json: Option<Value>,
pub triggered_fields: Vec<usize>,
}Expand description
Pending task for execution
Represents a node that has been scheduled for execution in the next superstep.
Fields§
§id: StringUnique task identifier
node_name: StringName of the node to execute
trigger: TaskTriggerWhat triggered this task
state_override: Option<S>Optional state override for this task (as JSON for Send operations)
state_json: Option<Value>Optional state override as JSON (for Send operations)
Stored separately because Send operations provide state as serde_json::Value,
which can’t be deserialized to S without S: DeserializeOwned bound.
This is deserialized during task execution in the runner.
triggered_fields: Vec<usize>Field indices that triggered this task
Tracks which specific fields had updates that caused this task to be scheduled. This allows fine-grained consumption of only triggered channels instead of consuming all changed fields.
Implementations§
Source§impl<S: State> PendingTask<S>
impl<S: State> PendingTask<S>
Sourcepub const fn new(
id: String,
node_name: String,
trigger: TaskTrigger,
state_override: Option<S>,
triggered_fields: Vec<usize>,
) -> Self
pub const fn new( id: String, node_name: String, trigger: TaskTrigger, state_override: Option<S>, triggered_fields: Vec<usize>, ) -> Self
Create a new pending task
§Examples
use juncture_core::pregel::types::{PendingTask, TaskTrigger};
use juncture_core::State;
let task = PendingTask::<MyState> {
id: "task-123".to_string(),
node_name: "my_node".to_string(),
trigger: TaskTrigger::Pull,
state_override: None,
state_json: None,
triggered_fields: vec![],
};Sourcepub const fn pull_with_triggered(
id: String,
node_name: String,
triggered_fields: Vec<usize>,
) -> Self
pub const fn pull_with_triggered( id: String, node_name: String, triggered_fields: Vec<usize>, ) -> Self
Create a pull-based task with triggered fields
Sourcepub const fn push(
id: String,
node_name: String,
index: usize,
state_json: Value,
) -> Self
pub const fn push( id: String, node_name: String, index: usize, state_json: Value, ) -> Self
Create a push-based task with state override as JSON
This is used for Send operations where the state override comes from
SendTarget.state (a serde_json::Value).
Sourcepub const fn push_typed(
id: String,
node_name: String,
index: usize,
state_override: S,
) -> Self
pub const fn push_typed( id: String, node_name: String, index: usize, state_override: S, ) -> Self
Create a push-based task with typed state override
This variant is used when the state override is already available as the typed state S (not just JSON).