Skip to main content

DagFlow

Struct DagFlow 

Source
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,

Source

pub fn new(name: &str) -> Self

Create a new DAG workflow builder

Source

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

Source

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

Source

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

Source

pub fn validate(&self) -> Result<(), DagFlowError>

Validate the DAG for cycles

Source

pub fn to_dot(&self) -> String

Export the DAG to DOT format

Trait Implementations§

Source§

impl<B> Debug for DagFlow<B>
where B: BackendExt + Debug, B::Compact: Debug, B::Context: Debug, B::IdType: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B> Display for DagFlow<B>
where B: BackendExt,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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>>,

Source§

type Backend = RawDataBackend<B>

The backend type for the worker
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, Args, Ctx, Svc, B, M> IntoWorkerServiceExt<Args, Ctx, Svc, B, M> for T
where T: IntoWorkerService<B, Svc, Args, Ctx>, B: Backend<Args = Args, Context = Ctx>, Svc: Service<Task<Args, Ctx, <B as Backend>::IdType>>,

Source§

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
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more