Cleanup minor Supervisor TODOs

e.g. Mainly making default parameter for restart/destroy/status API
calls to operate on all nodes.
This commit is contained in:
Jon Siwek 2020-01-14 13:41:46 -08:00
parent 80b3aef486
commit 4d712d6203
5 changed files with 178 additions and 137 deletions

View file

@ -39,25 +39,25 @@ export {
nodes: table[string] of NodeStatus;
};
global status: function(nodes: string &default="all"): Status;
global create: function(node: NodeConfig): string;
global destroy: function(nodes: string): bool;
global restart: function(nodes: string &default="all"): bool;
global status: function(node: string &default=""): Status;
global restart: function(node: string &default=""): bool;
global destroy: function(node: string &default=""): bool;
global is_supervisor: function(): bool;
global is_supervised: function(): bool;
global Supervisor::stop_request: event();
global Supervisor::status_request: event(reqid: string, nodes: string);
global Supervisor::status_response: event(reqid: string, result: Status);
global Supervisor::create_request: event(reqid: string, node: NodeConfig);
global Supervisor::create_response: event(reqid: string, result: string);
global Supervisor::destroy_request: event(reqid: string, nodes: string);
global Supervisor::status_request: event(reqid: string, node: string);
global Supervisor::status_response: event(reqid: string, result: Status);
global Supervisor::restart_request: event(reqid: string, node: string);
global Supervisor::restart_response: event(reqid: string, result: bool);
global Supervisor::destroy_request: event(reqid: string, node: string);
global Supervisor::destroy_response: event(reqid: string, result: bool);
global Supervisor::restart_request: event(reqid: string, nodes: string);
global Supervisor::restart_response: event(reqid: string, result: bool);
global Supervisor::stop_request: event();
}

View file

@ -21,9 +21,9 @@ event Supervisor::stop_request()
terminate();
}
event Supervisor::status_request(reqid: string, nodes: string)
event Supervisor::status_request(reqid: string, node: string)
{
local res = Supervisor::status(nodes);
local res = Supervisor::status(node);
local topic = Supervisor::topic_prefix + fmt("/status_response/%s", reqid);
Broker::publish(topic, Supervisor::status_response, reqid, res);
}
@ -35,23 +35,23 @@ event Supervisor::create_request(reqid: string, node: NodeConfig)
Broker::publish(topic, Supervisor::create_response, reqid, res);
}
event Supervisor::destroy_request(reqid: string, nodes: string)
event Supervisor::destroy_request(reqid: string, node: string)
{
local res = Supervisor::destroy(nodes);
local res = Supervisor::destroy(node);
local topic = Supervisor::topic_prefix + fmt("/destroy_response/%s", reqid);
Broker::publish(topic, Supervisor::destroy_response, reqid, res);
}
event Supervisor::restart_request(reqid: string, nodes: string)
event Supervisor::restart_request(reqid: string, node: string)
{
local res = Supervisor::restart(nodes);
local res = Supervisor::restart(node);
local topic = Supervisor::topic_prefix + fmt("/restart_response/%s", reqid);
Broker::publish(topic, Supervisor::restart_response, reqid, res);
}
function Supervisor::status(nodes: string): Status
function Supervisor::status(node: string): Status
{
return Supervisor::__status(nodes);
return Supervisor::__status(node);
}
function Supervisor::create(node: NodeConfig): string
@ -59,14 +59,14 @@ function Supervisor::create(node: NodeConfig): string
return Supervisor::__create(node);
}
function Supervisor::destroy(nodes: string): bool
function Supervisor::destroy(node: string): bool
{
return Supervisor::__destroy(nodes);
return Supervisor::__destroy(node);
}
function Supervisor::restart(nodes: string): bool
function Supervisor::restart(node: string): bool
{
return Supervisor::__restart(nodes);
return Supervisor::__restart(node);
}
function is_supervisor(): bool