Worker

trait Worker[Actor, Context]

Represents a Worker for a given Actor

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def canTakeJob(context: WorkContext[Actor, Context]): Job => Boolean

Predicate discriminator used to determine if a worker can carry out a job.

Predicate discriminator used to determine if a worker can carry out a job.

Value Params
context

Information about the context the worker is in

Returns

Job => Boolean

def generateJobs(context: WorkContext[Actor, Context]): List[Job]

The worker has nothing to do, create jobs from within the given context.

The worker has nothing to do, create jobs from within the given context.

Value Params
context

Information about the context the worker is in

Returns

List[Job]

def isJobComplete(context: WorkContext[Actor, Context]): Job => Boolean

Test whether an actor thinks a job is complete.

Test whether an actor thinks a job is complete.

Value Params
context

Information about the context the worker is in

Returns

Job => Boolean

def onJobComplete(context: WorkContext[Actor, Context]): Job => Outcome[(List[Job], Actor)]

When a job is completed, produce an outcome of any new jobs and an updated Actor.

When a job is completed, produce an outcome of any new jobs and an updated Actor.

Value Params
context

Information about the context the worker is in

Returns

Job => Outcome[(List[Job], Actor)]

def workOnJob(context: WorkContext[Actor, Context]): Job => (Job, Actor)

A function describing how this actor does work on whichever jobs they are able to work on.

A function describing how this actor does work on whichever jobs they are able to work on.

Value Params
context

Information about the context the worker is in

Returns

Job => (Job, Actor)