UNPKG

hazelcast-client

Version:

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

162 lines (161 loc) 6.02 kB
/// <reference types="bluebird" /> import { SerializationService } from './serialization/SerializationService'; import { InvocationService } from './invocation/InvocationService'; import { ListenerService } from './ListenerService'; import { ClientConfig } from './config/Config'; import * as Promise from 'bluebird'; import { IMap } from './proxy/IMap'; import { ISet } from './proxy/ISet'; import { LifecycleService } from './LifecycleService'; import { DistributedObject } from './DistributedObject'; import { ClientInfo } from './ClientInfo'; import { ClientConnectionManager } from './invocation/ClientConnectionManager'; import { ProxyManager } from './proxy/ProxyManager'; import { PartitionService } from './PartitionService'; import { ClusterService } from './invocation/ClusterService'; import { Heartbeat } from './HeartbeatService'; import { IQueue } from './proxy/IQueue'; import { IList } from './proxy/IList'; import { ILock } from './proxy/ILock'; import { MultiMap } from './proxy/MultiMap'; import { IRingbuffer } from './proxy/IRingbuffer'; import { ITopic } from './proxy/topic/ITopic'; import { IReplicatedMap } from './proxy/IReplicatedMap'; import { ISemaphore } from './proxy/ISemaphore'; import { IAtomicLong } from './proxy/IAtomicLong'; import { LockReferenceIdGenerator } from './LockReferenceIdGenerator'; import { RepairingTask } from './nearcache/RepairingTask'; import { ClientErrorFactory } from './protocol/ErrorFactory'; import { FlakeIdGenerator } from './proxy/FlakeIdGenerator'; import { PNCounter } from './proxy/PNCounter'; export default class HazelcastClient { private config; private loggingService; private serializationService; private invocationService; private listenerService; private connectionManager; private partitionService; private clusterService; private lifecycleService; private proxyManager; private heartbeat; private lockReferenceIdGenerator; private mapRepairingTask; private errorFactory; /** * Creates a new client object and automatically connects to cluster. * @param config Default {@link ClientConfig} is used when this parameter is absent. * @returns a new client instance */ static newHazelcastClient(config?: ClientConfig): Promise<HazelcastClient>; constructor(config?: ClientConfig); private init(); /** * Gathers information of this local client. * @returns {ClientInfo} */ getLocalEndpoint(): ClientInfo; /** * Gives all known distributed objects in cluster. * @returns {Promise<DistributedObject[]>|Promise<T>} */ getDistributedObjects(): Promise<DistributedObject[]>; /** * Returns the distributed map instance with given name. * @param name * @returns {IMap<K, V>} */ getMap<K, V>(name: string): IMap<K, V>; /** * Returns the distributed set instance with given name. * @param name * @returns {ISet<E>} */ getSet<E>(name: string): ISet<E>; /** * Returns the distributed lock instance with given name. * @param name * @returns {ILock} */ getLock(name: string): ILock; /** * Returns the distributed queue instance with given name. * @param name * @returns {IQueue<E>} */ getQueue<E>(name: string): IQueue<E>; /** * Returns the distributed list instance with given name. * @param name * @returns {IQueue<E>} */ getList<E>(name: string): IList<E>; /** * Returns the distributed multi-map instance with given name. * @param name * @returns {MultiMap<K, V>} */ getMultiMap<K, V>(name: string): MultiMap<K, V>; /** * Returns a distributed ringbuffer instance with the given name. * @param name * @returns {IRingbuffer<E>} */ getRingbuffer<E>(name: string): IRingbuffer<E>; /** * Returns a distributed reliable topic instance with the given name. * @param name * @returns {ITopic<E>} */ getReliableTopic<E>(name: string): ITopic<E>; getReplicatedMap<K, V>(name: string): IReplicatedMap<K, V>; getAtomicLong(name: string): IAtomicLong; getFlakeIdGenerator(name: string): FlakeIdGenerator; getPNCounter(name: string): PNCounter; /** * Returns the distributed semaphore instance with given name. * @param name * @returns {ISemaphore} */ getSemaphore(name: string): ISemaphore; /** * Return configuration that this instance started with. * Returned configuration object should not be modified. * @returns {ClientConfig} */ getConfig(): ClientConfig; getSerializationService(): SerializationService; getInvocationService(): InvocationService; getListenerService(): ListenerService; getConnectionManager(): ClientConnectionManager; getPartitionService(): PartitionService; getProxyManager(): ProxyManager; getClusterService(): ClusterService; getHeartbeat(): Heartbeat; getLifecycleService(): LifecycleService; getRepairingTask(): RepairingTask; /** * Registers a distributed object listener to cluster. * @param listenerFunc Callback function will be called with following arguments. * <ul> * <li>service name</li> * <li>distributed object name</li> * <li>name of the event that happened: either 'created' or 'destroyed'</li> * </ul> * @returns registration id of the listener. */ addDistributedObjectListener(listenerFunc: Function): Promise<string>; /** * Removes a distributed object listener from cluster. * @param listenerId id of the listener to be removed. * @returns `true` if registration is removed, `false` otherwise. */ removeDistributedObjectListener(listenerId: string): Promise<boolean>; getLockReferenceIdGenerator(): LockReferenceIdGenerator; getErrorFactory(): ClientErrorFactory; /** * Shuts down this client instance. */ shutdown(): void; }