MapReduceActor

com.phasmid.majabigwaduce.core.MapReduceActor

Shared lifecycle support for the actors in this package (Mapper, Reducer, Master).

Akka Typed behaviors are composed, not inherited, so this replaces what was previously an abstract Actor base class. withLifecycle wraps a command handler with the same debug-level start/stop logging the old base class provided via preStart/postStop. Each actor's own command handler recognizes its own protocol's Close case and returns Behaviors.stopped -- there is no shared Close type across protocols, since each actor's command ADT is self-contained.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def maybeLog(logger: Logger, w: String, z: => Any): Unit

Logs a debug-level message if debug logging is enabled. This method evaluates the provided message lazily to avoid unnecessary computation if debug logging is not enabled.

Logs a debug-level message if debug logging is enabled. This method evaluates the provided message lazily to avoid unnecessary computation if debug logging is not enabled.

Value parameters

logger

the SLF4J logger to log against.

w

the debug message to log.

z

the data or computation to include in the log message.

Attributes

def withLifecycle[T](logger: Logger)(makeHandler: ActorContext[T] => T => Behavior[T]): Behavior[T]

Wraps a command handler with debug-level start/stop logging.

Wraps a command handler with debug-level start/stop logging.

makeHandler is invoked exactly once, when the actor starts, and is given the ActorContext so it can perform any one-time setup (e.g. Master spawning its mapper and reducer children) before returning the actual per-message handler. Actors with no such setup (Mapper, Reducer) simply ignore the context and return a constant handler.

Type parameters

T

the command type handled by this behavior.

Value parameters

logger

the SLF4J logger to log against.

makeHandler

builds the command handler; the handler is responsible for recognizing its own protocol's Close case and returning Behaviors.stopped.

Attributes

Returns

a Behavior[T].