X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fselection-strategies-types.ts;h=3e7c3427e84f7bedb015e8f6d7ef54215377bd40;hb=7e060ceea2e476067edc0a19a02fdfd35df7bb8a;hp=dd545d41f590acdeada321782ee23fc51606168f;hpb=23ff945ac0bc3b9bcf98c6491872cffaac805b73;p=poolifier.git diff --git a/src/pools/selection-strategies/selection-strategies-types.ts b/src/pools/selection-strategies/selection-strategies-types.ts index dd545d41..3e7c3427 100644 --- a/src/pools/selection-strategies/selection-strategies-types.ts +++ b/src/pools/selection-strategies/selection-strategies-types.ts @@ -1,4 +1,4 @@ -import type { AbstractPoolWorker } from '../abstract-pool-worker' +import type { IPoolWorker } from '../pool-worker' /** * Enumeration of worker choice strategies. @@ -27,18 +27,33 @@ export const WorkerChoiceStrategies = Object.freeze({ */ export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies +/** + * Pool tasks usage statistics requirements. + */ +export interface RequiredStatistics { + runTime: boolean +} + /** * Worker choice strategy interface. * - * @template Worker Type of worker which manages the strategy. + * @typeParam Worker - Type of worker which manages the strategy. */ -export interface IWorkerChoiceStrategy { +export interface IWorkerChoiceStrategy { /** * Is the pool attached to the strategy dynamic?. */ - isDynamicPool: boolean + readonly isDynamicPool: boolean + /** + * Required pool tasks usage statistics. + */ + readonly requiredStatistics: RequiredStatistics + /** + * Resets strategy internals (counters, statistics, etc.). + */ + reset: () => boolean /** - * Choose a worker in the pool. + * Chooses a worker in the pool. */ - choose(): Worker + choose: () => Worker }