pub struct GraphExecutor {
pub max_steps: usize,
/* private fields */
}Expand description
Graph 执行器 — 可配置运行时参数。
支持可选的 Checkpoint 集成,实现持久化执行。
Fields§
§max_steps: usize全局运行时步数限制。 1 Step = 1 Node Entry。
Implementations§
Source§impl GraphExecutor
impl GraphExecutor
Sourcepub fn with_checkpoint(
max_steps: usize,
store: Arc<dyn CheckpointStore>,
policy: CheckpointPolicy,
graph: &Graph,
) -> Self
pub fn with_checkpoint( max_steps: usize, store: Arc<dyn CheckpointStore>, policy: CheckpointPolicy, graph: &Graph, ) -> Self
创建带 Checkpoint 的执行器。
Sourcepub fn set_store(&mut self, store: Arc<dyn CheckpointStore>)
pub fn set_store(&mut self, store: Arc<dyn CheckpointStore>)
设置 Checkpoint 存储后端。
Sourcepub fn set_policy(&mut self, policy: CheckpointPolicy)
pub fn set_policy(&mut self, policy: CheckpointPolicy)
设置 Checkpoint 频率策略。
Sourcepub fn register_reducer(&mut self, key: &str, reducer: Reducer)
pub fn register_reducer(&mut self, key: &str, reducer: Reducer)
注册 key 的 Reducer(用于 ParallelNode 合并策略)。
Sourcepub fn set_checkpoint_score(self, score: CheckpointScore) -> Self
pub fn set_checkpoint_score(self, score: CheckpointScore) -> Self
设置 Adaptive Checkpoint 评分器。
Sourcepub async fn execute(
&self,
graph: Arc<Graph>,
initial_state: State,
) -> Result<GraphResult, GraphError>
pub async fn execute( &self, graph: Arc<Graph>, initial_state: State, ) -> Result<GraphResult, GraphError>
执行 Graph(阻塞模式)。
Blocking is derived from stream. 内部消费 stream 直到结束。
⚠️ BarrierNode 不支持阻塞模式。 如果图中包含 BarrierNode,
会提前返回错误,引导用户使用 execute_stream()。
Sourcepub fn execute_stream(
&self,
graph: Arc<Graph>,
initial_state: State,
) -> GraphExecution
pub fn execute_stream( &self, graph: Arc<Graph>, initial_state: State, ) -> GraphExecution
流式执行 Graph,返回 GraphExecution(stream + handle)。
Stream is primary, Blocking is derived.
Sourcepub async fn resume_from(
&self,
store: &dyn CheckpointStore,
trace_id: &TraceId,
graph: &Arc<Graph>,
) -> Result<GraphExecution, GraphError>
pub async fn resume_from( &self, store: &dyn CheckpointStore, trace_id: &TraceId, graph: &Arc<Graph>, ) -> Result<GraphExecution, GraphError>
Trait Implementations§
Source§impl Clone for GraphExecutor
impl Clone for GraphExecutor
Source§impl Debug for GraphExecutor
impl Debug for GraphExecutor
Auto Trait Implementations§
impl !RefUnwindSafe for GraphExecutor
impl !UnwindSafe for GraphExecutor
impl Freeze for GraphExecutor
impl Send for GraphExecutor
impl Sync for GraphExecutor
impl Unpin for GraphExecutor
impl UnsafeUnpin for GraphExecutor
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
Mutably borrows from an owned value. Read more