Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IParallelStream<TSubResult, TEndResult>

Parallel processing stream that allows access to the sub results or end result of a IParallelJob

The end result can be retrieved by using the then function. The then function is called with the merged result of all tasks. At the other hand, subscribe can be used to register an onNext handler that is called with the result of every spawned task. This allows to stream to the task results and using intermediate results until all tasks have completed.

Catch can be used to register to task failures. Without a catch handler, task failures are silently ignored. The stream implements a fast fail interface. If any task fail, all other tasks are canceled.

Type parameters

  • TSubResult

    the results produced by a single task that needs to be joined to the end result

  • TEndResult

    the joined result of all tasks.

Hierarchy

Implemented by

Index

Methods

Methods

catch

  • catch<TResult>(onrejected: function): Promise<TEndResult | TResult>
  • catch(onrejected: function): Promise<TEndResult>
  • 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<TEndResult | 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): TEndResult | PromiseLike<TEndResult>
        • Parameters

          • reason: any

          Returns TEndResult | PromiseLike<TEndResult>

    Returns Promise<TEndResult>

    A Promise for the completion of the callback.

subscribe

  • subscribe(onNext: function, onError?: undefined | function, onComplete?: undefined | function): IParallelStream<TSubResult, TEndResult>
  • 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: TSubResult, taskIndex: number, valuesPerWorker: number): void
        • Parameters

          • this: void
          • subResult: TSubResult
          • 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<TSubResult, TEndResult>

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: TEndResult): TResult1 | PromiseLike<TResult1>
        • Parameters

          • value: TEndResult

          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: TEndResult): TResult | PromiseLike<TResult>
        • Parameters

          • value: TEndResult

          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: TEndResult): TResult | PromiseLike<TResult>
        • Parameters

          • value: TEndResult

          Returns TResult | PromiseLike<TResult>

    Returns Promise<TResult>

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

Generated using TypeDoc