MapReduceFirstFold

com.phasmid.majabigwaduce.core.MapReduceFirstFold
See theMapReduceFirstFold companion object
case class MapReduceFirstFold[V0, K1, W, V1](f: V0 => Try[(K1, W)], g: (V1, W) => V1)(actors: Actors, timeout: Timeout)(using evidence$1: Zero[V1]) extends MapReduce_LoggingBase[V0, Unit, V0, K1, V1]

A first-stage MapReduce class

Type parameters

K1

output key type.

V0

input value type.

V1

output value type (must support type class Init).

W

intermediate type.

Value parameters

actors

an instance of Actors.

f

the mapper function which takes a V0 instance and creates a key-value tuple of type (K1,W) (wrapped in Try, but see alternative constructor).

g

the reducer function which combines two values (an V1 and a W) into one V1.

timeout

the value of timeout to be used. CONSIDER why is config parameter set not implicit?

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class MapReduce_LoggingBase[V0, Unit, V0, K1, V1]
class MapReduce_Base[V0, Unit, V0, K1, V1]
trait MapReduce[V0, K1, V1]
trait AutoCloseable
trait Seq[V0] => Future[Map[K1, V1]]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def createBehavior: Behavior[MasterCommand[Unit, V0, K1, V1]]

Creates and returns the Behavior for the master actor.

Creates and returns the Behavior for the master actor.

Attributes

Returns

the Behavior used for actor creation

override def createName: Option[String]

Provides the name of the MapReduce master actor used in the first-stage fold operation.

Provides the name of the MapReduce master actor used in the first-stage fold operation.

Attributes

Returns

An Option[String] containing the name of the MapReduce master actor, if defined.

Definition Classes
def toMasterPair(t: V0): (Unit, V0)

Converts an input item of type T into the (key, value) pair the master's own protocol expects. For a first-stage MapReduce, this pairs T with a Unit key; for a subsequent stage, T already is the (K,V) pair the master expects.

Converts an input item of type T into the (key, value) pair the master's own protocol expects. For a first-stage MapReduce, this pairs T with a Unit key; for a subsequent stage, T already is the (K,V) pair the master expects.

Attributes

Inherited methods

def &[K2, V2](mr: MapReduce[(K1, V1), K2, V2]): MapReduce[V0, K2, V2]

Alternative formulation for compose method (:&)

Alternative formulation for compose method (:&)

Type parameters

K2

the key type of the composed MapReduce object

V2

the value type of the composed MapReduce object

Value parameters

mr

the other MapReduce object

Attributes

Returns

a new MapReduceComposed object

Inherited from:
MapReduce
def :&[K2, V2](f: Seq[(K1, V1)] => Future[Map[K2, V2]]): MapReduce[V0, K2, V2]

Compose this MapReduce object with mr, yielding a new MapReduce object.

Compose this MapReduce object with mr, yielding a new MapReduce object.

Type parameters

K2

the key type of the composed MapReduce object

V2

the value type of the composed MapReduce object

Value parameters

f

a function of type ASync[Seq[(K1, V1)], Map[K2, V2], i.e. Seq[(K1, V1)]=>Future[Map[K2, V2]

Attributes

Returns

a new MapReduceComposed object

Inherited from:
MapReduce
def :|[S](r: Map[K1, V1] => S)(implicit executionContext: ExecutionContext): Seq[V0] => Future[S]

terminate this MapReduce object with r, a reducer which yields a simple value

terminate this MapReduce object with r, a reducer which yields a simple value

Type parameters

S

the return type, which is a super-class of V1 (for sum, or sigma)

Value parameters

executionContext

(implicit)

r

the Reduce object

Attributes

Returns

an Async function of Seq[T]=>Future[S] type S.

Inherited from:
MapReduce
def andThen[A](g: Future[Map[K1, V1]] => A): Seq[V0] => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
def apply(ts: Seq[V0]): Future[Map[K1, V1]]

Processes a sequence of input items, communicates with the master actor to retrieve results, and optionally reports the response. NOTE: currently, we ignore the value of report, but we could pass back a tuple that includes ok and the resulting map

Processes a sequence of input items, communicates with the master actor to retrieve results, and optionally reports the response. NOTE: currently, we ignore the value of report, but we could pass back a tuple that includes ok and the resulting map

Value parameters

ts

the sequence of input items to be processed

Attributes

Returns

a Future containing a map of key-value pairs representing the computed results

Inherited from:
MapReduce_Base
def close(): Unit

Stops the master actor (and, transitively, its mapper and reducer children) to release resources and terminate associated processes.

Stops the master actor (and, transitively, its mapper and reducer children) to release resources and terminate associated processes.

Attributes

Returns

Unit, as the method performs an action and does not produce a value.

Inherited from:
MapReduce_Base
def compose[A](g: A => Seq[V0]): A => Future[Map[K1, V1]]

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
def logException(m: => String, x: Throwable): Unit

Logs an exception using the provided message and throwable.

Logs an exception using the provided message and throwable.

Value parameters

m

the message to be logged; this is a lazy parameter and will only be evaluated if needed

x

the exception to be logged alongside the message

Attributes

Returns

Unit, as this method performs a logging side effect and does not return a value

Inherited from:
MapReduce_LoggingBase
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1
def |[S](r: Map[K1, V1] => S)(implicit executionContext: ExecutionContext): Seq[V0] => Future[S]

alternative name to terminate

alternative name to terminate

Type parameters

S

the return type, which is a super-class of V1 (for sum, or sigma)

Value parameters

executionContext

(implicit)

r

the Reduce object

Attributes

Returns

an Async function of Seq[T]=>Future[S] type S.

Inherited from:
MapReduce

Givens

Inherited givens

given ec: ExecutionContext

Attributes

Returns

a suitable execution context

Inherited from:
MapReduce_Base