mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
Add skeleton logic for handling supevisor control messages
This commit is contained in:
parent
e46cf88435
commit
7c08488dfc
5 changed files with 170 additions and 34 deletions
|
@ -4,18 +4,19 @@
|
|||
module Supervisor;
|
||||
|
||||
export {
|
||||
type Status: record {
|
||||
# TODO: add proper status fields
|
||||
n: count;
|
||||
};
|
||||
|
||||
type NodeConfig: record {
|
||||
# TODO: add proper config field
|
||||
type Node: record {
|
||||
# TODO: add proper config fields
|
||||
name: string;
|
||||
};
|
||||
|
||||
type Status: record {
|
||||
# TODO: add proper status fields
|
||||
n: count;
|
||||
nodes: table[string] of Node;
|
||||
};
|
||||
|
||||
global status: function(nodes: string &default="all"): Status;
|
||||
global create: function(config: NodeConfig): string;
|
||||
global create: function(node: Node): string;
|
||||
global destroy: function(nodes: string): bool;
|
||||
global restart: function(nodes: string &default="all"): bool;
|
||||
|
||||
|
@ -24,7 +25,7 @@ export {
|
|||
global Supervisor::status_request: event(id: count, nodes: string);
|
||||
global Supervisor::status_response: event(id: count, result: Status);
|
||||
|
||||
global Supervisor::create_request: event(id: count, config: NodeConfig);
|
||||
global Supervisor::create_request: event(id: count, node: Node);
|
||||
global Supervisor::create_response: event(id: count, result: string);
|
||||
|
||||
global Supervisor::destroy_request: event(id: count, nodes: string);
|
||||
|
|
|
@ -28,9 +28,9 @@ event Supervisor::status_request(id: count, nodes: string)
|
|||
Broker::publish(topic, Supervisor::status_response, id, res);
|
||||
}
|
||||
|
||||
event Supervisor::create_request(id: count, config: NodeConfig)
|
||||
event Supervisor::create_request(id: count, node: Node)
|
||||
{
|
||||
local res = Supervisor::create(config);
|
||||
local res = Supervisor::create(node);
|
||||
local topic = Supervisor::topic_prefix + "/create_response";
|
||||
Broker::publish(topic, Supervisor::create_response, id, res);
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ function Supervisor::status(nodes: string): Status
|
|||
return Supervisor::__status(nodes);
|
||||
}
|
||||
|
||||
function create(config: NodeConfig): string
|
||||
function create(node: Node): string
|
||||
{
|
||||
return Supervisor::__create(config);
|
||||
return Supervisor::__create(node);
|
||||
}
|
||||
|
||||
function destroy(nodes: string): bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue