import * as Consul from "consul"; import { IDriverAdaptor } from "../../"; import Service = Consul.Agent.Service; interface IHealth { api?: string; script?: string; interval?: string; ttl?: string; notes?: string; status?: string; } export interface IConsulConf { optional?: boolean; options?: { host?: string; port?: number; secure?: boolean; ca?: string[]; }; health: IHealth | IHealth[]; dc?: string; tags?: string[]; did?: { head_refresh?: "process" | "stable" | "dynamic"; }; request_fallback: { [key: string]: { http?: string; https?: string; tcp?: string; udp?: string; }; }; } export interface IServiceNode { id: string; address: string; port: number; healthy: boolean; } declare enum NodeStatus { NOTEXIST = 0, UNHEALTHY_ME = 1, UNHEALTHY_OTHER = 2, HEALTHY = 3 } export declare class DiscoverConsulDriver implements IDriverAdaptor { static inst: DiscoverConsulDriver; consul: Consul.Consul; didHead: number; protected conf: IConsulConf; protected log: import("winston").Logger; assert: import("@khgame/err/lib/assert").CAssert; protected servicesCache: import("../..").IMemCache; protected httpClientCache: import("../..").IMemCache; private didGenerator; static assertConsulExist(driver: DiscoverConsulDriver, methodName: string): void; static FieldExist(object: DiscoverConsulDriver, methodName: string, descriptor: TypedPropertyDescriptor): void; constructor(); protected loadConsul(): Promise; init(conf: IConsulConf): Promise; onApiStart(): Promise; onApiClose(): Promise; createServiceDIDHeader(): Promise; createServiceDID(base?: number): Promise; get(key: string): Promise<{ LockIndex: number; Key: string; Flags: number; Value: string; CreateIndex: number; ModifyIndex: number; }>; set(key: string, val: string): Promise<{}>; cas(key: string, value: string, modifyIndex: string): Promise; register(opts: Service.RegisterOptions): Promise; deregister(serviceId: string): Promise; httpClient(serviceName: string): Promise; serviceNodes(serviceName: string, onlyHealthy?: boolean): Promise; getServiceNames(): Promise; getServices(): Promise<{ [serviceName: string]: IServiceNode[]; }>; getSelf(): Promise; getStatusSelf(): Promise; } export {};