parallel-es
Version:
Simple parallelization for EcmaScript
29 lines (28 loc) • 1.75 kB
TypeScript
import { IParallelEnvironment } from "./parallel-environment";
import { FunctionCall } from "../function/function-call";
import { ISerializedFunctionCall } from "../function/serialized-function-call";
import { FunctionCallSerializer } from "../function/function-call-serializer";
/**
* Defines the environment for a parallel chain. The environment can consist of one or multiple static environments or
* environments created by using an environment provider. The environments are merged in the order they have been added
* to the parallel chain, meaning that later environments override the properties of earlier environments.
* The implementation tries to minimize the number of environment variables to transfer by merging the environments as much
* as possible while still maintaining the sequential order of the environments.
*/
export declare class ParallelEnvironmentDefinition {
environments: Array<IParallelEnvironment | FunctionCall>;
static of(environment?: FunctionCall | IParallelEnvironment): ParallelEnvironmentDefinition;
private static EMPTY;
private constructor(environments?);
/**
* Adds the given environment
*
* The operation tries to keep the operation chain to a minimal in length. If two subsequent environments are
* not providers, then the definitions are merged.
* @param environment the new environment to add
* @returns {ParallelEnvironmentDefinition} the new parallel environment resulting from adding the passed in environment
* to the existing one
*/
add(environment: FunctionCall | IParallelEnvironment): ParallelEnvironmentDefinition;
toJSON(functionCallSerializer: FunctionCallSerializer): Array<ISerializedFunctionCall | IParallelEnvironment>;
}