X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fselection-strategies-types.ts;h=21e4129eeca6d9e09619647ab7b80abbd299032c;hb=d15211d4a844f29140004fc2814316e62547aee0;hp=4d302f3defb1e7d5619d37693daf4104c944f377;hpb=10fcfaf49c0b6d6f0e1d137eeba1e9d805c9a815;p=poolifier.git diff --git a/src/pools/selection-strategies/selection-strategies-types.ts b/src/pools/selection-strategies/selection-strategies-types.ts index 4d302f3d..21e4129e 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. @@ -28,9 +28,9 @@ export const WorkerChoiceStrategies = Object.freeze({ export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies /** - * Tasks usage statistics requirements. + * Pool tasks usage statistics requirements. */ -export type RequiredStatistics = { +export interface RequiredStatistics { runTime: boolean } @@ -39,17 +39,21 @@ export type RequiredStatistics = { * * @template 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 tasks usage statistics. + * Required pool tasks usage statistics. */ - requiredStatistics: RequiredStatistics + readonly requiredStatistics: RequiredStatistics /** - * Choose a worker in the pool. + * Resets strategy internals (counters, statistics, etc.). */ - choose(): Worker + reset: () => boolean + /** + * Chooses a worker in the pool. + */ + choose: () => Worker }