UNPKG

hazelcast-client

Version:

Hazelcast - open source In-Memory Data Grid - client for NodeJS

70 lines (69 loc) 2.23 kB
/// <reference types="node" /> /// <reference types="bluebird" /> import { ClientConnection } from './ClientConnection'; import * as Promise from 'bluebird'; import { Member } from '../core/Member'; import { EventEmitter } from 'events'; import { ClientInfo } from '../ClientInfo'; import HazelcastClient from '../HazelcastClient'; import { MemberSelector } from '../core/MemberSelector'; /** * Manages the relationship of this client with the cluster. */ export declare class ClusterService extends EventEmitter { /** * The unique identifier of the owner server node. This node is responsible for resource cleanup */ ownerUuid: string; /** * The unique identifier of this client instance. Assigned by owner node on authentication */ uuid: string; private knownAddresses; private members; private client; private ownerConnection; private logger; constructor(client: HazelcastClient); /** * Starts cluster service. * @returns */ start(): Promise<void>; /** * Connects to cluster. It uses the addresses provided in the configuration. * @returns */ connectToCluster(): Promise<void>; /** * Returns the list of members in the cluster. * @returns */ getMembers(selector?: MemberSelector): Member[]; /** * Returns the number of nodes in cluster. * @returns {number} */ getSize(): number; /** * Returns information about this client. * @returns {ClientInfo} */ getClientInfo(): ClientInfo; private initHeartbeatListener(); private initConnectionListener(); private onConnectionClosed(connection); private onHeartbeatStopped(connection); private tryAddresses(index, attemptLimit, attemptPeriod); /** * Returns the connection associated with owner node of this client. * @returns {ClientConnection} */ getOwnerConnection(): ClientConnection; initMemberShipListener(): Promise<void>; private handleMember(member, eventType); private handleMemberList(members); private handleMemberAttributeChange(uuid, key, operationType, value); private memberAdded(member); private memberRemoved(member); }