MapperCommand

com.phasmid.majabigwaduce.core.MapperCommand
sealed trait MapperCommand[K1, V1, K2, W]

The purpose of this mapper is to convert a sequence of objects into several sequences, each of which is associated with a key. It must be possible to do further processing (the reduce phase) on each of these resulting sequences independently (and, thus in parallel). Furthermore, the mapping function should try, when possible, to divide the input sequence into a number of more or less equally lengthy sequences.

The mapper is an actor whose behavior is parametrized by a function f which converts a (K1,V1) into a (K2,W). It handles a DoMap command carrying a KeyValuePairs[K1,V1] and a replyTo reference. It replies with a MapperResponse[K2,W], which carries both the successfully-mapped results and any exceptions encountered while mapping -- whether that constitutes an overall failure is a decision made by the caller (see Master.doMap), not by the Mapper itself.

KeyValuePairs is a convenience wrapper for incoming messages. It has the advantage of not suffering type erasure, and it also has a toString method which simply shows the number of pairs, not their values.

Note that logging the actual values received in the incoming message can be VERY verbose. It is therefore recommended practice (if required) to log the values as they pass through the mapper function (f) which is under the control of the application.

Type parameters

K1

(input) key type (may be Unit)

K2

(output) key type

V1

(input) value type

W

(output) value type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class CloseMapper[K1, V1, K2, W]
class DoMap[K1, V1, K2, W]
In this article