repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: cleanup variables namespace
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
selection-strategies-types.ts
diff --git
a/src/pools/selection-strategies/selection-strategies-types.ts
b/src/pools/selection-strategies/selection-strategies-types.ts
index 26fe436d7a8e587b651458e8359a0b4d0a2e27f9..7a5a10c6018fda998f61143c42b47fb9bd4d8e41 100644
(file)
--- a/
src/pools/selection-strategies/selection-strategies-types.ts
+++ b/
src/pools/selection-strategies/selection-strategies-types.ts
@@
-14,6
+14,12
@@
export const WorkerChoiceStrategies = Object.freeze({
* Least busy worker selection strategy.
*/
LEAST_BUSY: 'LEAST_BUSY',
* Least busy worker selection strategy.
*/
LEAST_BUSY: 'LEAST_BUSY',
+ /**
+ * Least ELU worker selection strategy.
+ *
+ * @experimental
+ */
+ LEAST_ELU: 'LEAST_ELU',
/**
* Fair share worker selection strategy.
*/
/**
* Fair share worker selection strategy.
*/
@@
-35,10
+41,24
@@
export const WorkerChoiceStrategies = Object.freeze({
*/
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
*/
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
+/**
+ * Enumeration of measurements.
+ */
+export const Measurements = Object.freeze({
+ runTime: 'runTime',
+ waitTime: 'waitTime',
+ elu: 'elu'
+} as const)
+
+/**
+ * Measurement.
+ */
+export type Measurement = keyof typeof Measurements
+
/**
* Measurement options.
*/
/**
* Measurement options.
*/
-interface MeasurementOptions {
+
export
interface MeasurementOptions {
/**
* Set measurement median.
*/
/**
* Set measurement median.
*/
@@
-49,6
+69,10
@@
interface MeasurementOptions {
* Worker choice strategy options.
*/
export interface WorkerChoiceStrategyOptions {
* Worker choice strategy options.
*/
export interface WorkerChoiceStrategyOptions {
+ /**
+ * Measurement to use for worker choice strategy.
+ */
+ measurement?: Measurement
/**
* Runtime options.
*
/**
* Runtime options.
*
@@
-61,6
+85,12
@@
export interface WorkerChoiceStrategyOptions {
* @defaultValue \{ median: false \}
*/
waitTime?: MeasurementOptions
* @defaultValue \{ median: false \}
*/
waitTime?: MeasurementOptions
+ /**
+ * Event loop utilization options.
+ *
+ * @defaultValue \{ median: false \}
+ */
+ elu?: MeasurementOptions
/**
* Worker weights to use for weighted round robin worker selection strategy.
* Weight is the tasks maximum average or median runtime in milliseconds.
/**
* Worker weights to use for weighted round robin worker selection strategy.
* Weight is the tasks maximum average or median runtime in milliseconds.
@@
-75,7
+105,7
@@
export interface WorkerChoiceStrategyOptions {
*
* @internal
*/
*
* @internal
*/
-interface MeasurementStatisticsRequirements {
+
export
interface MeasurementStatisticsRequirements {
/**
* Require measurement aggregate.
*/
/**
* Require measurement aggregate.
*/
@@
-105,15
+135,31
@@
export interface TaskStatisticsRequirements {
*/
waitTime: MeasurementStatisticsRequirements
/**
*/
waitTime: MeasurementStatisticsRequirements
/**
- *
Event loop utilization
.
+ *
Tasks event loop utilization requirements
.
*/
*/
- elu: boolean
+ elu: MeasurementStatisticsRequirements
+}
+
+/**
+ * Strategy policy.
+ *
+ * @internal
+ */
+export interface StrategyPolicy {
+ /**
+ * Expect direct usage of dynamic worker.
+ */
+ useDynamicWorker: boolean
}
/**
* Worker choice strategy interface.
*/
export interface IWorkerChoiceStrategy {
}
/**
* Worker choice strategy interface.
*/
export interface IWorkerChoiceStrategy {
+ /**
+ * Strategy policy.
+ */
+ readonly strategyPolicy: StrategyPolicy
/**
* Tasks statistics requirements.
*/
/**
* Tasks statistics requirements.
*/