pub struct DagFlow<B>where
B: BackendExt,{ /* private fields */ }Expand description
Directed Acyclic Graph (DAG) workflow builder
Implementations§
Source§impl<B> DagFlow<B>where
B: BackendExt,
impl<B> DagFlow<B>where
B: BackendExt,
Sourcepub fn add_node<S, Input, CodecError>(
&self,
name: &str,
service: S,
) -> NodeBuilder<'_, Input, S::Response, B>where
S: Service<Task<Input, B::Context, B::IdType>> + Send + 'static + Sync + Clone,
S::Future: Send + 'static,
B::Codec: Codec<Input, Compact = B::Compact, Error = CodecError> + Codec<S::Response, Compact = B::Compact, Error = CodecError> + 'static,
CodecError: Into<BoxDynError> + Send + 'static,
S::Error: Into<BoxDynError>,
B: Send + Sync + 'static,
Input: DagCodec<B, Error = CodecError> + Send + Sync + 'static,
pub fn add_node<S, Input, CodecError>(
&self,
name: &str,
service: S,
) -> NodeBuilder<'_, Input, S::Response, B>where
S: Service<Task<Input, B::Context, B::IdType>> + Send + 'static + Sync + Clone,
S::Future: Send + 'static,
B::Codec: Codec<Input, Compact = B::Compact, Error = CodecError> + Codec<S::Response, Compact = B::Compact, Error = CodecError> + 'static,
CodecError: Into<BoxDynError> + Send + 'static,
S::Error: Into<BoxDynError>,
B: Send + Sync + 'static,
Input: DagCodec<B, Error = CodecError> + Send + Sync + 'static,
Add a node to the DAG
Sourcepub fn node<F, Input, O, FnArgs, Err, CodecError>(
&self,
node: F,
) -> NodeBuilder<'_, Input, O, B>where
TaskFn<F, Input, B::Context, FnArgs>: Service<Task<Input, B::Context, B::IdType>, Response = O, Error = Err> + Clone,
F: Send + 'static + Sync,
Input: Send + 'static + Sync + DagCodec<B, Error = CodecError>,
FnArgs: Send + 'static + Sync,
B::Context: Send + Sync + 'static,
<TaskFn<F, Input, B::Context, FnArgs> as Service<Task<Input, B::Context, B::IdType>>>::Future: Send + 'static,
B::Codec: Codec<Input, Compact = B::Compact, Error = CodecError> + 'static + Codec<O, Compact = B::Compact, Error = CodecError>,
CodecError: Into<BoxDynError> + Send + 'static,
Err: Into<BoxDynError>,
B: Send + Sync + 'static,
pub fn node<F, Input, O, FnArgs, Err, CodecError>(
&self,
node: F,
) -> NodeBuilder<'_, Input, O, B>where
TaskFn<F, Input, B::Context, FnArgs>: Service<Task<Input, B::Context, B::IdType>, Response = O, Error = Err> + Clone,
F: Send + 'static + Sync,
Input: Send + 'static + Sync + DagCodec<B, Error = CodecError>,
FnArgs: Send + 'static + Sync,
B::Context: Send + Sync + 'static,
<TaskFn<F, Input, B::Context, FnArgs> as Service<Task<Input, B::Context, B::IdType>>>::Future: Send + 'static,
B::Codec: Codec<Input, Compact = B::Compact, Error = CodecError> + 'static + Codec<O, Compact = B::Compact, Error = CodecError>,
CodecError: Into<BoxDynError> + Send + 'static,
Err: Into<BoxDynError>,
B: Send + Sync + 'static,
Add a task function node to the DAG
Sourcepub fn route<F, Input, O, FnArgs, Err, CodecError>(
&self,
router: F,
) -> NodeBuilder<'_, Input, O, B>where
TaskFn<F, Input, B::Context, FnArgs>: Service<Task<Input, B::Context, B::IdType>, Response = O, Error = Err> + Clone,
F: Send + 'static + Sync,
Input: Send + 'static + Sync + DagCodec<B, Error = CodecError>,
FnArgs: Send + 'static + Sync,
<TaskFn<F, Input, B::Context, FnArgs> as Service<Task<Input, B::Context, B::IdType>>>::Future: Send + 'static,
O: Into<NodeIndex>,
B::Context: Send + Sync + 'static,
B::Codec: Codec<Input, Compact = B::Compact, Error = CodecError> + 'static + Codec<O, Compact = B::Compact, Error = CodecError>,
CodecError: Into<BoxDynError> + Send + 'static,
Err: Into<BoxDynError>,
B: Send + Sync + 'static,
pub fn route<F, Input, O, FnArgs, Err, CodecError>(
&self,
router: F,
) -> NodeBuilder<'_, Input, O, B>where
TaskFn<F, Input, B::Context, FnArgs>: Service<Task<Input, B::Context, B::IdType>, Response = O, Error = Err> + Clone,
F: Send + 'static + Sync,
Input: Send + 'static + Sync + DagCodec<B, Error = CodecError>,
FnArgs: Send + 'static + Sync,
<TaskFn<F, Input, B::Context, FnArgs> as Service<Task<Input, B::Context, B::IdType>>>::Future: Send + 'static,
O: Into<NodeIndex>,
B::Context: Send + Sync + 'static,
B::Codec: Codec<Input, Compact = B::Compact, Error = CodecError> + 'static + Codec<O, Compact = B::Compact, Error = CodecError>,
CodecError: Into<BoxDynError> + Send + 'static,
Err: Into<BoxDynError>,
B: Send + Sync + 'static,
Add a routing node to the DAG
Sourcepub fn validate(&self) -> Result<(), DagFlowError>
pub fn validate(&self) -> Result<(), DagFlowError>
Validate the DAG for cycles
Trait Implementations§
Source§impl<B> Display for DagFlow<B>where
B: BackendExt,
impl<B> Display for DagFlow<B>where
B: BackendExt,
Source§impl<B, Compact, Err> IntoWorkerService<B, RootDagService<B>, <B as BackendExt>::Compact, <B as Backend>::Context> for DagFlow<B>where
B: BackendExt<Compact = Compact, Args = Compact, Error = Err> + Clone,
Err: Error + Send + Sync + 'static,
B::Context: MetadataExt<DagFlowContext<B::IdType>> + Send + Sync + 'static,
B::IdType: Send + Sync + 'static + Default + GenerateId + PartialEq + Debug,
B::Compact: Send + Sync + 'static + Clone,
RootDagService<B>: Service<Task<Compact, B::Context, B::IdType>>,
impl<B, Compact, Err> IntoWorkerService<B, RootDagService<B>, <B as BackendExt>::Compact, <B as Backend>::Context> for DagFlow<B>where
B: BackendExt<Compact = Compact, Args = Compact, Error = Err> + Clone,
Err: Error + Send + Sync + 'static,
B::Context: MetadataExt<DagFlowContext<B::IdType>> + Send + Sync + 'static,
B::IdType: Send + Sync + 'static + Default + GenerateId + PartialEq + Debug,
B::Compact: Send + Sync + 'static + Clone,
RootDagService<B>: Service<Task<Compact, B::Context, B::IdType>>,
Source§type Backend = RawDataBackend<B>
type Backend = RawDataBackend<B>
The backend type for the worker
Source§fn into_service(
self,
b: B,
) -> WorkerService<RawDataBackend<B>, RootDagService<B>>
fn into_service( self, b: B, ) -> WorkerService<RawDataBackend<B>, RootDagService<B>>
Build the service from the backend
Auto Trait Implementations§
impl<B> !Freeze for DagFlow<B>
impl<B> RefUnwindSafe for DagFlow<B>
impl<B> Send for DagFlow<B>
impl<B> Sync for DagFlow<B>
impl<B> Unpin for DagFlow<B>
impl<B> UnsafeUnpin for DagFlow<B>
impl<B> UnwindSafe for DagFlow<B>
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
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, Args, Ctx, Svc, B, M> IntoWorkerServiceExt<Args, Ctx, Svc, B, M> for T
impl<T, Args, Ctx, Svc, B, M> IntoWorkerServiceExt<Args, Ctx, Svc, B, M> for T
Source§fn build_with(
self,
builder: WorkerBuilder<Args, Ctx, B, M>,
) -> Worker<Args, Ctx, <T as IntoWorkerService<B, Svc, Args, Ctx>>::Backend, Svc, M>
fn build_with( self, builder: WorkerBuilder<Args, Ctx, B, M>, ) -> Worker<Args, Ctx, <T as IntoWorkerService<B, Svc, Args, Ctx>>::Backend, Svc, M>
Consumes the builder and returns a worker