acm-client
Version:
aliyun acm client
54 lines (53 loc) • 1.48 kB
TypeScript
import { IServerListManager, ServerListMgrOptions } from './interface';
declare const Base: any;
export declare class ServerListManager extends Base implements IServerListManager {
private isSync;
private isClosed;
private serverListCache;
private currentUnit;
/**
* 服务地址列表管理器
*
* @param {Object} options
* - {HttpClient} httpclient - http 客户端
* - {Snapshot} [snapshot] - 快照对象
* - {String} nameServerAddr - 命名服务器地址 `hostname:port`
* @constructor
*/
constructor(options: ServerListMgrOptions);
readonly snapshot: any;
readonly httpclient: any;
readonly nameServerAddr: any;
readonly refreshInterval: any;
/**
* 关闭地址列表服务
*/
close(): void;
private request;
getCurrentUnit(): Promise<any>;
/**
* 获取某个单元的地址
* @param {String} unit 单元名,默认为当前单元
* @return {String} address
*/
getOne(unit?: any): Promise<any>;
/**
* 同步服务器列表
* @return {void}
*/
syncServers(): void;
fetchServerList(unit?: any): Promise<{
hosts: any;
index: any;
}>;
formatKey(unit: any): any;
private getRequestUrl;
/**
* 获取单元列表
* @return {Array} units
*/
fetchUnitLists(): Promise<any[]>;
hasServerInCache(serverName: any): any;
clearaServerCache(): void;
}
export {};