import { Instance } from "../instance"; import { ServiceRouterPlugin, LoadBalancerPlugin, NamingServicePlugin, PluginType, ServiceRules } from "../plugins"; import { Service } from "../service"; import { LocalRegistry } from "../registry"; import { Health } from "./health"; import { Logger } from "../logging"; declare const kDefaultOptions: { /** * 探活任务最大探测次数 */ maxProbes: number; /** * 是否启用全死全活,当节点全部不健康时,是否返回 */ enableRecover: boolean; }; export declare type SelectorOptions = typeof kDefaultOptions; export declare type CombinatedArgs = Record; export interface CallArgsType { [PluginType.ServiceRouter]?: ServiceRouterArgs; [PluginType.LoadBalancer]?: LoadBalancerArgs; } export interface Selector { select(callee: Service, caller?: Service, args?: CallArgsType): Promise; list(namespace: string, service: string): Promise; rules(namespace: string, service: string): Promise; dispose?(): void; } /** * @description * 实例选取规则: * in ---> [Router Chain] ---> out */ export declare class InternalSelector implements Selector { private readonly logger; private readonly health; private readonly registry; private readonly routers; private readonly lb; private readonly fuseStat; private readonly options; private readonly requisite; private disposed; constructor(logger: Logger, health: Health, registry: LocalRegistry, routers: ServiceRouterPlugin[], lb: LoadBalancerPlugin, options?: Partial); dispose(): void; select(callee: Service, caller?: Service, args?: CallArgsType): Promise; list(namespace: string, service: string): Promise; rules(namespace: string, service: string): Promise; private executor; /** * ``` * +-------------------------+ * | | * ... [+----+----> Service Router Plugin +----+---->] ... ... * | | | | * | +-------------------------+ | * | | * +-----------------------------------+ * ``` */ private routing; private choose; } export declare class ExternalSelector implements Selector { private readonly naming; constructor(naming: NamingServicePlugin); select(callee: Service): Promise; list(namespace: string, service: string): Promise; rules(namespace: string, service: string): Promise; } export {};