mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Separate supervisor node config and status data structures
This commit is contained in:
parent
520c6e3ebf
commit
0ff99c3df8
6 changed files with 93 additions and 64 deletions
|
@ -19,7 +19,7 @@ export {
|
|||
interface: string &optional;
|
||||
};
|
||||
|
||||
type Node: record {
|
||||
type NodeConfig: record {
|
||||
name: string;
|
||||
interface: string &optional;
|
||||
directory: string &optional;
|
||||
|
@ -28,18 +28,19 @@ export {
|
|||
scripts: vector of string &default = vector();
|
||||
cpu_affinity: int &optional;
|
||||
cluster: table[string] of ClusterEndpoint &default=table();
|
||||
};
|
||||
|
||||
# TODO: separate node config fields from status fields ?
|
||||
# TODO: add more status fields ?
|
||||
pid: count &optional;
|
||||
type NodeStatus: record {
|
||||
node: NodeConfig;
|
||||
pid: count;
|
||||
};
|
||||
|
||||
type Status: record {
|
||||
nodes: table[string] of Node;
|
||||
nodes: table[string] of NodeStatus;
|
||||
};
|
||||
|
||||
global status: function(nodes: string &default="all"): Status;
|
||||
global create: function(node: Node): string;
|
||||
global create: function(node: NodeConfig): string;
|
||||
global destroy: function(nodes: string): bool;
|
||||
global restart: function(nodes: string &default="all"): bool;
|
||||
|
||||
|
@ -51,7 +52,7 @@ export {
|
|||
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: Node);
|
||||
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);
|
||||
|
|
|
@ -28,7 +28,7 @@ event Supervisor::status_request(reqid: string, nodes: string)
|
|||
Broker::publish(topic, Supervisor::status_response, reqid, res);
|
||||
}
|
||||
|
||||
event Supervisor::create_request(reqid: string, node: Node)
|
||||
event Supervisor::create_request(reqid: string, node: NodeConfig)
|
||||
{
|
||||
local res = Supervisor::create(node);
|
||||
local topic = Supervisor::topic_prefix + fmt("/create_response/%s", reqid);
|
||||
|
@ -54,7 +54,7 @@ function Supervisor::status(nodes: string): Status
|
|||
return Supervisor::__status(nodes);
|
||||
}
|
||||
|
||||
function Supervisor::create(node: Node): string
|
||||
function Supervisor::create(node: NodeConfig): string
|
||||
{
|
||||
return Supervisor::__create(node);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue