zeek/scripts/base/frameworks/supervisor/api.zeek
Jon Siwek 29f386e388 Implement minimal supervised cluster configuration
More aspects of the cluster configuration to get fleshed out later,
but a basic cluster like one would use for a live deployment
can now be instantiated and run under supervision.  The new
clusterized-pcap-processing supervisor mode is also not done yet.
2019-10-23 17:37:53 -07:00

54 lines
1.4 KiB
Text

##! The Zeek process supervision API.
# TODO: add proper docs
module Supervisor;
export {
type ClusterRole: enum {
NONE,
LOGGER,
MANAGER,
PROXY,
WORKER,
};
type ClusterEndpoint: record {
role: ClusterRole;
host: addr;
p: port;
interface: string &optional;
};
type Node: record {
name: string;
interface: string &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 Status: record {
nodes: table[string] of Node;
};
global status: function(nodes: string &default="all"): Status;
global create: function(node: Node): string;
global destroy: function(nodes: string): bool;
global restart: function(nodes: string &default="all"): 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: Node);
global Supervisor::create_response: event(reqid: string, result: string);
global Supervisor::destroy_request: event(reqid: string, nodes: 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);
}