Jobs
Job communication protocolNOTE: All constants replaced with short identifiers? Base64 encoded ids?
All communication includes UUID of communicator
IDEA: Communication that includes worker id may be issued as direct message, and not need ID in message?
- Job provider announces job (broadcast)job id - Unique identifier, randomly selected (UUID?)
job type id - Globally recognised identifier for the job type
- ANNOUNCE [job id]:[job type id]
- Workers capable of performing [job type id], that has no next job already accepted, responds
time available - Length of time until the worker will be available
- This will be padded for an estimate of travel time
job skill - The workers skill at performing the job
- AVAIL [job id]:[time available]:[job skill]
- Job provider selects candidate for the job. May be based on various criteria, such as soonest time available, best/sufficent skill, or possibly job announcement may be pre-emptive and provider chooses worker based on least wasted waiting time.
worker id - communicator UUID
- HIRE [worker id]:[job id]
- Worker hears HIRE. Stores that it will be performing job next. Does not make a response.
Job provider waits for worker. If does not respond in [time available] + buffer, job provider may dismiss worker.- DISMISS [worker id]:[job id]
Job provider returns to ANNOUNCE stage.
When current job is complete, worker moves to provider, announces start.- START [job id]
Waits for perform. If not heard in time, QUIT is issued.
Job provider acknowledges START.
time - Length of time to perform job
- Time is used for approximation and display purposes. Worker does not finish until QUIT or DISMISS conditions.
- PERFORM [job id]:[job type id]:[time]
Worker acknowledges PERFORM.- PERFORMING [job id]
If time is completed (job is completed to satisfaction of job provider), or cancelled, job provider dismisses worker. Also, if worker has not responded with START to HIRE in good time.
- DISMISS [worker id]:[job id]
Worker hears DISMISS, removes any reference to job (queued as next job, moving to perform, waiting to perform, or performing)If worker decides to stop working (needs food/drink/is hurt/conscripted etc), issues QUIT
- QUIT [job id]
Job issuer hears QUIT, returns to ANNOUNCE