UNPKG

@duongtrungnguyen/nestro

Version:
27 lines 934 B
import { WeightedRoundRobinStrategy } from "./weighted-round-robin.strategy"; import { LeastConnectionsStrategy } from "./least-connection.strategy"; import { ResponseTimeStrategy } from "./response-time.strategy"; import { RoundRobinStrategy } from "./round-robin.strategy"; import { RandomStrategy } from "./random.strategy"; class LoadBalancingFactory { static getStrategy(strategyType) { switch (strategyType) { case "random": return new RandomStrategy(); case "round-robin": return new RoundRobinStrategy(); case "least-connections": return new LeastConnectionsStrategy(); case "weighted-round-robin": return new WeightedRoundRobinStrategy(); case "response-time": return new ResponseTimeStrategy(); default: return new RoundRobinStrategy(); } } } export { LoadBalancingFactory }; //# sourceMappingURL=load-balancing.factory.js.map