Skip to content

Controller interface

Pierre Lasorak edited this page Nov 14, 2023 · 7 revisions

This page provides an entry point to the way the drunc server should be interfaced.

This document refers to the Controller in particular. Its proto file can be found here

Messages

Remember that all the messages sent to and received from the controller follow the drunc schema described here. All the messages described here will end up in some form or another in the data fields of the Request and Response after being Anyfied.

Endpoints

Each RPC call is described here.

describe

... is already described in here.

describe_fsm

One can ask the controller to specifically describe its FSM. The controller will answer with data of the format FSMCommandsDescription. This message will contain a list of FSMCommandDescription. These commands can contain a list of Arguments that need to be specified for some transitions.

FSM commands

FSM commands can be sent to the controller by using the RPC endpoint execute_fsm_command, by setting the data in the request to be and FSMCommand. The command specifies:

message FSMCommand{
  string command_name = 1;
  map<string, google.protobuf.Any> arguments = 2;
  repeated string children_nodes = 3;
  optional string data = 4;
}
  • command_name (1) is the usual conf, start, drain_dataflow etc.
  • arguments (2) are a map of argument names to values. These are defined by the FSM interfaces, and the list is accessible by doing describe_fsm.
  • children_nodes (3) is a list of children on which to execute the FSM command. If nothing is specified, the controller the command on all the children.
  • data (4) is a JSON string that is produced by the controller's FSM interfaces, and used to communicate between controllers. The user should not fill this out manually.

Status call

The get_status or get_children_status call can be issued at any point, the controller will return a Status message or a list of statuses for each of the children. There is no way to get status deeper than one of a direct child.

Include/Exclude

Excluded nodes won't be passed FSM commands. This command will apply to the controller and all its descendants.

service Controller {
  rpc ls                         (Request) returns (Response) {}
  rpc describe                   (Request) returns (Response) {}
  rpc get_children_status        (Request) returns (Response) {}
  rpc get_status                 (Request) returns (Response) {}

  rpc describe_fsm               (Request) returns (Response) {}
  rpc execute_fsm_command        (Request) returns (Response) {}
  rpc include                    (Request) returns (Response) {}
  rpc exclude                    (Request) returns (Response) {}

  rpc take_control               (Request) returns (Response) {}
  rpc surrender_control          (Request) returns (Response) {}
  rpc who_is_in_charge           (Request) returns (Response) {}
}
Clone this wiki locally