Skip to the content.

Topology protocol

The following components comprise the distributed setting for qtopology:

Worker statuses

Worker

Ideally, runs as single instance on single server (but there is no obstacle to having several workers on single machine). It needs the following:

It then creates an instance of a coordinator, passes to it the method of coordination and awaits instructions. These include command start, which starts the topology with provided definition.

Coordinator

A subordinate class of worker - takes care of coordination with other workers.

It also contains a subordinate class that handles leadership checks and repated tasks.

Local topology

This object:

Status transitions

Worker statuses

Worker statuses

Topology statuses

Topology statuses

Sequence between coordinator, worker and local topology

The worker first performs the initialization sequence and the runs two sequences in parallel, infinite loops:

Initial sequence

Coordination storage Worker
  Register worker
Puts worker in worker list  

Topology statuses

Leadership sequence

Coordination storage Worker
  Checks if leadership is established
Returns leadership status  
  If leadership is ok, do nothing else
  Sends leadership candidacy
Registers candidacy  
  Checks candidacy
Sends true if candidacy sucessfull  
  If not elected leader, do nothing more
  Gets worker statuses
Returns worker statuses after marking those with overdue pings as dead  
  For all dead workers unassigns their topologies
Updates statuses for these topologies  
  Pronounces dead workers as unloaded
Stores new worker statuses  
  Gets topology statuses
Gets topology statuses after setting overdue waiting status to unassigned and setting topologies of dead worker to unassigned  
  Assigns unassigned and stopped topologies to new workers by setting the to status waiting
Stores new statuses for these topologies  
Stores messages for workers to load topologies  

Topology statuses

Active-worker sequence

Coordination storage Worker
  Get messages for this worker
Returns messages for this worker  
  Handle message such as “start topology” or “shutdown”
Update topology status if start successful  

Topology statuses