pub struct Chain { /* private fields */ }
Expand description
The Chain
struct represents a map-reduce chain, consisting of a map
step and a reduce
step.
The struct is generic over the type of the Step
and provides methods for constructing and
executing the chain using a given Executor
.
Implementations§
Source§impl Chain
impl Chain
Sourcepub fn new(map: Step, reduce: Step) -> Chain
pub fn new(map: Step, reduce: Step) -> Chain
Constructs a new Chain
with the given map
and reduce
steps.
The new
function takes two instances of Step
and returns a new Chain
instance.
Sourcepub async fn run<E: Executor>(
&self,
documents: Vec<Parameters>,
base_parameters: Parameters,
executor: &E,
) -> Result<Output, MapReduceChainError>
pub async fn run<E: Executor>( &self, documents: Vec<Parameters>, base_parameters: Parameters, executor: &E, ) -> Result<Output, MapReduceChainError>
Executes the map-reduce chain using the provided Executor
.
The run
function takes a vector of input documents, a base set of parameters, and a reference
to an Executor
. It processes the input documents using the map
step and the reduce
step,
and returns the result as an Option<E::Output>
.
The function is asynchronous and must be awaited.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chain
impl<'de> Deserialize<'de> for Chain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl StorableEntity for Chain
Implements the StorableEntity
trait for the Chain
struct.
impl StorableEntity for Chain
Implements the StorableEntity
trait for the Chain
struct.
This implementation provides a method for extracting metadata from a Chain
instance, in order to identify it
Source§fn get_metadata() -> Vec<(String, String)>
fn get_metadata() -> Vec<(String, String)>
Returns metadata about the Chain instance.
The metadata is returned as a vector of tuples, where each tuple contains a key-value pair representing a metadata field and its value.
This method also extracts metadata from the Step instances associated with the Chain.