UNPKG

@duongtrungnguyen/nestro

Version:
50 lines 2.12 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var load_balancing_factory_exports = {}; __export(load_balancing_factory_exports, { LoadBalancingFactory: () => LoadBalancingFactory }); module.exports = __toCommonJS(load_balancing_factory_exports); var import_weighted_round_robin = require("./weighted-round-robin.strategy"); var import_least_connection = require("./least-connection.strategy"); var import_response_time = require("./response-time.strategy"); var import_round_robin = require("./round-robin.strategy"); var import_random = require("./random.strategy"); class LoadBalancingFactory { static getStrategy(strategyType) { switch (strategyType) { case "random": return new import_random.RandomStrategy(); case "round-robin": return new import_round_robin.RoundRobinStrategy(); case "least-connections": return new import_least_connection.LeastConnectionsStrategy(); case "weighted-round-robin": return new import_weighted_round_robin.WeightedRoundRobinStrategy(); case "response-time": return new import_response_time.ResponseTimeStrategy(); default: return new import_round_robin.RoundRobinStrategy(); } } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { LoadBalancingFactory }); //# sourceMappingURL=load-balancing.factory.js.map