pub struct ChildConfig {
pub serdes: Option<Arc<dyn SerDesAny>>,
pub replay_children: bool,
pub error_mapper: Option<Arc<dyn Fn(DurableError) -> DurableError + Send + Sync>>,
pub summary_generator: Option<Arc<dyn Fn(&str) -> String + Send + Sync>>,
}Expand description
Configuration for child context operations.
This configuration controls how child contexts behave, including whether to replay children when loading state for large parallel operations.
Fields§
§serdes: Option<Arc<dyn SerDesAny>>Optional custom serializer/deserializer.
replay_children: boolWhether to replay children when loading state.
When set to true, the child context will request child operations
to be included in state loads during replay. This is useful for large
parallel operations where the combined output needs to be reconstructed
by replaying each branch.
Default is false for better performance in most cases.
error_mapper: Option<Arc<dyn Fn(DurableError) -> DurableError + Send + Sync>>Optional function to map child context errors before propagation.
When set, this function is applied to errors from child context execution before they are checkpointed and propagated. Suspend errors are never mapped.
Default is None, which preserves current behavior (errors propagate unchanged).
summary_generator: Option<Arc<dyn Fn(&str) -> String + Send + Sync>>Optional function to generate a summary when the serialized child result exceeds 256KB.
When set, this function is invoked with the serialized result string if its size exceeds 256KB (262144 bytes). The returned summary string is stored instead of the full result, enabling replay-based reconstruction for large payloads.
When the serialized result is 256KB or less, the full result is stored even if a summary generator is configured.
Default is None, which preserves current behavior (full result stored regardless of size).
Implementations§
Source§impl ChildConfig
impl ChildConfig
Sourcepub fn with_replay_children() -> Self
pub fn with_replay_children() -> Self
Creates a ChildConfig with replay_children enabled.
Use this when you need to reconstruct the combined output of a large parallel operation by replaying each branch.
§Example
use durable_execution_sdk::ChildConfig;
let config = ChildConfig::with_replay_children();
assert!(config.replay_children);Sourcepub fn set_replay_children(self, replay_children: bool) -> Self
pub fn set_replay_children(self, replay_children: bool) -> Self
Sets the replay_children option.
§Arguments
replay_children- Whether to replay children when loading state
Sourcepub fn set_serdes(self, serdes: Arc<dyn SerDesAny>) -> Self
pub fn set_serdes(self, serdes: Arc<dyn SerDesAny>) -> Self
Sets the custom serializer/deserializer.
Sourcepub fn set_error_mapper(
self,
mapper: Arc<dyn Fn(DurableError) -> DurableError + Send + Sync>,
) -> Self
pub fn set_error_mapper( self, mapper: Arc<dyn Fn(DurableError) -> DurableError + Send + Sync>, ) -> Self
Sets the error mapper function.
The error mapper is applied to child context errors before they are checkpointed and propagated. Suspend errors are never mapped.
Sourcepub fn set_summary_generator(
self,
generator: Arc<dyn Fn(&str) -> String + Send + Sync>,
) -> Self
pub fn set_summary_generator( self, generator: Arc<dyn Fn(&str) -> String + Send + Sync>, ) -> Self
Sets the summary generator function.
The summary generator is invoked when the serialized child result exceeds 256KB (262144 bytes). It receives the serialized result string and should return a compact summary string to store instead.
Trait Implementations§
Source§impl Clone for ChildConfig
impl Clone for ChildConfig
Source§fn clone(&self) -> ChildConfig
fn clone(&self) -> ChildConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChildConfig
impl Debug for ChildConfig
Source§impl Default for ChildConfig
impl Default for ChildConfig
Source§fn default() -> ChildConfig
fn default() -> ChildConfig
Auto Trait Implementations§
impl Freeze for ChildConfig
impl !RefUnwindSafe for ChildConfig
impl Send for ChildConfig
impl Sync for ChildConfig
impl Unpin for ChildConfig
impl UnsafeUnpin for ChildConfig
impl !UnwindSafe for ChildConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more