pub enum SerializableContinuation {
Task {
id: String,
timeout_ms: Option<u64>,
retry_policy: Option<RetryPolicy>,
next: Option<Box<SerializableContinuation>>,
},
Fork {
id: String,
branches: Vec<SerializableContinuation>,
join: Option<Box<SerializableContinuation>>,
},
Delay {
id: String,
duration_ms: u64,
next: Option<Box<SerializableContinuation>>,
},
AwaitSignal {
id: String,
signal_name: String,
timeout_ms: Option<u64>,
next: Option<Box<SerializableContinuation>>,
},
}Expand description
A serializable workflow continuation (stores only IDs and structure).
This type can be serialized/deserialized and later converted back into a runnable
WorkflowContinuation using a TaskRegistry.
§Serialization
// Serialize a workflow
let serializable = workflow.continuation().to_serializable();
let json = serde_json::to_string(&serializable)?;
// Deserialize and convert to runnable
let serializable: SerializableContinuation = serde_json::from_str(&json)?;
let continuation = serializable.to_runnable(®istry)?;Variants§
Task
Fork
Delay
AwaitSignal
Implementations§
Source§impl SerializableContinuation
impl SerializableContinuation
Sourcepub fn to_runnable(
&self,
registry: &TaskRegistry,
) -> Result<WorkflowContinuation, WorkflowError>
pub fn to_runnable( &self, registry: &TaskRegistry, ) -> Result<WorkflowContinuation, WorkflowError>
Convert this serializable continuation into a runnable WorkflowContinuation.
Looks up each task ID in the registry to get the actual implementation.
§Errors
Returns WorkflowError::TaskNotFound if any task ID is not in the registry.
Sourcepub fn compute_definition_hash(&self) -> String
pub fn compute_definition_hash(&self) -> String
Compute a SHA256 hash of this continuation’s structure.
This hash serves as a “version” identifier for the workflow definition. It can be used to detect when a serialized workflow state was created with a different workflow definition than the current one.
The hash is computed from the canonical structure of task IDs and their arrangement.
Trait Implementations§
Source§impl Clone for SerializableContinuation
impl Clone for SerializableContinuation
Source§fn clone(&self) -> SerializableContinuation
fn clone(&self) -> SerializableContinuation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more