export = ClusterCommand; declare class ClusterCommand { /** * @constructor * @param {ClusterNode} localNode */ constructor(localNode: ClusterNode); node: ClusterNode; server: Reply; protoroot: protobuf.Root; state: 1; logger: import("../kuzzle/Logger").Logger; init(): Promise; serve(): Promise; /** * Listens to incoming requests and answer to them. * Do NOT await this method, it's meant to run indefinitely until the close() * method is invoked. * This method can (and should) never return a rejected promise. * * @returns {void} */ listen(): void; /** * Closes opened sockets and marks this server as closed. * @return {void} */ dispose(): void; /** * Sends back the full state to the requesting node * @return {void} */ sendFullState(): void; /** * Handles a handshake request from a remote node * @return {void} */ handleHandshake(data: any): void; /** * Request the full state from ONE of the remote nodes of the cluster, AT * RANDOM (necessary to make sure we distribute the full state serialization * load across all nodes) * * @param {Array.} nodes * @return {Object|null} Returns the fetched full state, or null if no node answered */ getFullState(nodes: Array): any | null; /** * Sends a handshake request to other remote nodes and process their response * Returns an object with the following structure: * * { * [nodeId]: { added: , lastMessageId: }, * [nodeId]: null, // no response received, node is probably dead * } * * @param {Array.} nodes * @return {Object} */ broadcastHandshake(nodes: Array): any; /** * Sends a handshake payload to a remote node, and waits for its response * * @param {string} id - remote node ID * @param {string} ip - remote node IP address * @param {Buffer} payload - handshake payload (protobuf encoded) * @return {Object|null} - handshake encoded response, or null if no * response was received */ _sendSingleHandshake(id: string, ip: string, payload: Buffer): any | null; } import { Reply } from "zeromq"; import protobuf = require("protobufjs");