UNPKG

node-universe

Version:

基于 Nodejs 环境的一款微服务框架,原理来自于宇宙中的恒星,行星,卫星等系统。

19 lines (18 loc) 658 B
import { GenericObject } from '../../typings'; import { Registry } from '../registry'; import Star from '../star'; import BaseStrategy from './base'; import { LRUCache } from 'lru-cache'; import Context from '../context'; import Endpoint from '../registry/endpoint/item'; export default class ShardStrategy extends BaseStrategy { cache: LRUCache<number, string>; needRebuild: boolean; ring: Array<any>; constructor(registry: Registry, star: Star, options: GenericObject); private getKeyFromContext; private getNodeIDByKey; private getHash; private rebuild; select(list: Endpoint[], ctx?: Context | undefined): Endpoint; }