Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IParallelChain<TIn, TEnv, TOut>

The parallel chain allows to chain multiple operations before they are executed on a worker. The parallel job is scheduled onto the thread pool as soon any terminating function like IParallelChain.then, IParallelChain.catch, IParallelChain.subscribe or IParallelChain.reduce is called.

Type parameters

  • TIn

    the input values created by a generator function

  • TEnv: IParallelEnvironment

    the type of the environment

  • TOut

    the type of the resulting elements

Hierarchy

Implemented by

Index

Methods

catch

  • catch<TResult>(onrejected: function): Promise<TOut[] | TResult>
  • catch(onrejected: function): Promise<TOut[]>
  • Attaches a callback for only the rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TResult | PromiseLike<TResult>
        • Parameters

          • reason: any

          Returns TResult | PromiseLike<TResult>

    Returns Promise<TOut[] | TResult>

    A Promise for the completion of the callback.

  • Attaches a callback for only the rejection of the Promise.

    Parameters

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TOut[] | PromiseLike<TOut[]>
        • Parameters

          • reason: any

          Returns TOut[] | PromiseLike<TOut[]>

    Returns Promise<TOut[]>

    A Promise for the completion of the callback.

filter

inEnvironment

  • inEnvironment<TEnvNew>(newEnv: TEnvNew): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TEnvNew>(provider: function): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TEnvNew>(provider: IFunctionId): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TParam1, TEnvNew>(provider: function, param1: TParam1): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TParam1, TParam2, TEnvNew>(provider: function, param1: TParam1, param2: TParam2): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TParam1, TParam2, TParam3, TEnvNew>(provider: function, param1: TParam1, param2: TParam2, param3: TParam3): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TParam1, TParam2, TParam3, TParam4, TEnvNew>(provider: function, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • inEnvironment<TParam1, TParam2, TParam3, TParam4, TEnvNew>(provider: function, param1: TParam1, param2: TParam2, param3: TParam3, param4: TParam4, ...furtherParams: any[]): IParallelChain<TIn, TEnv & TEnvNew, TOut>
  • Defines the environment that is provided to all iteratee or generator functions. The environment cannot contain function values. The values of the provided environment is merged with the values of any prior defined environments. If an environment provider is defined, then the values returned by the environment provider have a higher precedence.

    Type parameters

    Parameters

    • newEnv: TEnvNew

      the environment that is provided to the iteratee function

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

  • Defines a function that should be used to build the environment for each task. The function is executed first on the scheduled task.

    Type parameters

    Parameters

    • provider: function

      the function providing the environment

        • (this: void, taskEnv: TEnv & IParallelTaskEnvironment): TEnvNew
        • Parameters

          • this: void
          • taskEnv: TEnv & IParallelTaskEnvironment

          Returns TEnvNew

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

    the chain

  • Type parameters

    Parameters

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

  • Type parameters

    Parameters

    • provider: function
        • (this: void, arg1: TParam1, taskEnv: TEnv & IParallelTaskEnvironment): TEnvNew
        • Parameters

          • this: void
          • arg1: TParam1
          • taskEnv: TEnv & IParallelTaskEnvironment

          Returns TEnvNew

    • param1: TParam1

      single parameter that is passed to the provider

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

  • Type parameters

    • TParam1

      type of the first parameter

    • TParam2

      type of the second parameter

    • TEnvNew: IParallelEnvironment

    Parameters

    • provider: function
        • (this: void, arg1: TParam1, arg2: TParam2, taskEnv: TEnv & IParallelTaskEnvironment): TEnvNew
        • Parameters

          • this: void
          • arg1: TParam1
          • arg2: TParam2
          • taskEnv: TEnv & IParallelTaskEnvironment

          Returns TEnvNew

    • param1: TParam1

      first parameter that is passed to the provider function

    • param2: TParam2

      second parameter that is passed to the provider function

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

  • Type parameters

    Parameters

    • provider: function
        • (this: void, arg1: TParam1, arg2: TParam2, arg3: TParam3, taskEnv: TEnv & IParallelTaskEnvironment): TEnvNew
        • Parameters

          • this: void
          • arg1: TParam1
          • arg2: TParam2
          • arg3: TParam3
          • taskEnv: TEnv & IParallelTaskEnvironment

          Returns TEnvNew

    • param1: TParam1
    • param2: TParam2
    • param3: TParam3

      third parameter that is passed to the provider funciton

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

  • Type parameters

    Parameters

    • provider: function
        • (this: void, arg1: TParam1, arg2: TParam2, arg3: TParam3, arg4: TParam4, taskEnv: TEnv & IParallelTaskEnvironment): TEnvNew
        • Parameters

          • this: void
          • arg1: TParam1
          • arg2: TParam2
          • arg3: TParam3
          • arg4: TParam4
          • taskEnv: TEnv & IParallelTaskEnvironment

          Returns TEnvNew

    • param1: TParam1
    • param2: TParam2
    • param3: TParam3
    • param4: TParam4

      fourth parameter that is passed to the provider function

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

  • Type parameters

    Parameters

    • provider: function
        • (this: void, arg1: TParam1, arg2: TParam2, arg3: TParam3, arg4: TParam4, ...furtherParams: any[]): TEnvNew
        • Parameters

          • this: void
          • arg1: TParam1
          • arg2: TParam2
          • arg3: TParam3
          • arg4: TParam4
          • Rest ...furtherParams: any[]

          Returns TEnvNew

    • param1: TParam1
    • param2: TParam2
    • param3: TParam3
    • param4: TParam4
    • Rest ...furtherParams: any[]

      further paramters that are passed to the provider function

    Returns IParallelChain<TIn, TEnv & TEnvNew, TOut>

map

  • Maps all input values to an output value using the given mapper. The mapper is applied for each input element

    Type parameters

    • TResult

      the type of the resulting elements

    Parameters

    • mapper: function

      the mapper to apply for each element

        • (this: void, element: TOut, env: TEnv & IParallelTaskEnvironment): TResult
        • Parameters

          • this: void
          • element: TOut
          • env: TEnv & IParallelTaskEnvironment

          Returns TResult

    Returns IParallelChain<TIn, TEnv, TResult>

  • Type parameters

    • TResult

    Parameters

    Returns IParallelChain<TIn, TEnv, TResult>

reduce

  • Reduces the elements to a single value using the given accumulator. The accumulator is invoked with the - up to now - accumulated value and the current element and returns the sum of the accumulated value and the current value.

    Parameters

    • defaultValue: TOut

      default value to use to initialize the accumulator

    • accumulator: function

      the accumulator function

        • (this: void, memo: TOut, value: TOut, env: TEnv & IParallelTaskEnvironment): TOut
        • Parameters

          • this: void
          • memo: TOut
          • value: TOut
          • env: TEnv & IParallelTaskEnvironment

          Returns TOut

    Returns IParallelStream<TOut[], TOut>

    parallel stream that allows to query the end result

  • Parameters

    Returns IParallelStream<TOut[], TOut>

  • Reduces the elements to a single value using the givne accumulator. The accumulator is invoked with the - up to now - accumulated value and the current element and returns the sum of the accumulated value and the current value.

    Type parameters

    • TResult

      type of the end result

    Parameters

    • defaultValue: TResult

      default value to use to initialize the accumulator

    • accumulator: function

      the accumulator function

        • (this: void, memo: TResult, value: TOut, env: TEnv & IParallelTaskEnvironment): TResult
        • Parameters

          • this: void
          • memo: TResult
          • value: TOut
          • env: TEnv & IParallelTaskEnvironment

          Returns TResult

    • combiner: function
        • (this: void, subResult1: TResult, subResult2: TResult): TResult
        • Parameters

          • this: void
          • subResult1: TResult
          • subResult2: TResult

          Returns TResult

    Returns IParallelStream<TResult[], TResult>

    parallel stream that allows to query the end result

  • Type parameters

    • TResult

    Parameters

    • defaultValue: TResult
    • accumulator: IFunctionId
    • combiner: function
        • (this: void, subResult1: TResult, subResult2: TResult): TResult
        • Parameters

          • this: void
          • subResult1: TResult
          • subResult2: TResult

          Returns TResult

    Returns IParallelStream<TResult[], TResult>

subscribe

  • subscribe(onNext: function, onError?: undefined | function, onComplete?: undefined | function): IParallelStream<TOut[], TOut[]>
  • Registers the given next, error and complete handler.

    Parameters

    • onNext: function

      is called with the sub result produced by a completed task. The sub result of this task, the relative task number and the values processed by each worker (max) is passed to the onNext handler.

        • (this: void, subResult: TOut[], taskIndex: number, valuesPerWorker: number): void
        • Parameters

          • this: void
          • subResult: TOut[]
          • taskIndex: number
          • valuesPerWorker: number

          Returns void

    • Optional onError: undefined | function

      is invoked whenever any task has failed.

    • Optional onComplete: undefined | function

      is invoked with the joined result when all tasks have completed

    Returns IParallelStream<TOut[], TOut[]>

then

  • then<TResult1, TResult2>(onfulfilled: function, onrejected: function): Promise<TResult1 | TResult2>
  • then<TResult>(onfulfilled: function, onrejected: function): Promise<TResult>
  • then<TResult>(onfulfilled: function): Promise<TResult>
  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult1

    • TResult2

    Parameters

    • onfulfilled: function

      The callback to execute when the Promise is resolved.

        • (value: TOut[]): TResult1 | PromiseLike<TResult1>
        • Parameters

          • value: TOut[]

          Returns TResult1 | PromiseLike<TResult1>

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TResult2 | PromiseLike<TResult2>
        • Parameters

          • reason: any

          Returns TResult2 | PromiseLike<TResult2>

    Returns Promise<TResult1 | TResult2>

    A Promise for the completion of which ever callback is executed.

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • onfulfilled: function

      The callback to execute when the Promise is resolved.

        • (value: TOut[]): TResult | PromiseLike<TResult>
        • Parameters

          • value: TOut[]

          Returns TResult | PromiseLike<TResult>

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TResult | PromiseLike<TResult>
        • Parameters

          • reason: any

          Returns TResult | PromiseLike<TResult>

    Returns Promise<TResult>

    A Promise for the completion of which ever callback is executed.

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • onfulfilled: function

      The callback to execute when the Promise is resolved.

        • (value: TOut[]): TResult | PromiseLike<TResult>
        • Parameters

          • value: TOut[]

          Returns TResult | PromiseLike<TResult>

    Returns Promise<TResult>

    A Promise for the completion of which ever callback is executed.

Generated using TypeDoc