1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | /// <amd-module name="@angular/compiler-cli/ngcc/src/execution/cluster/utils" />
|
---|
9 | import { MessageFromWorker, MessageToWorker } from './api';
|
---|
10 | /** Expose a `Promise` instance as well as APIs for resolving/rejecting it. */
|
---|
11 | export declare class Deferred<T> {
|
---|
12 | /**
|
---|
13 | * Resolve the associated promise with the specified value.
|
---|
14 | * If the value is a rejection (constructed with `Promise.reject()`), the promise will be rejected
|
---|
15 | * instead.
|
---|
16 | *
|
---|
17 | * @param value The value to resolve the promise with.
|
---|
18 | */
|
---|
19 | resolve: (value: T) => void;
|
---|
20 | /**
|
---|
21 | * Rejects the associated promise with the specified reason.
|
---|
22 | *
|
---|
23 | * @param reason The rejection reason.
|
---|
24 | */
|
---|
25 | reject: (reason: any) => void;
|
---|
26 | /** The `Promise` instance associated with this deferred. */
|
---|
27 | promise: Promise<T>;
|
---|
28 | }
|
---|
29 | /**
|
---|
30 | * Send a message to the cluster master.
|
---|
31 | * (This function should be invoked from cluster workers only.)
|
---|
32 | *
|
---|
33 | * @param msg The message to send to the cluster master.
|
---|
34 | * @return A promise that is resolved once the message has been sent.
|
---|
35 | */
|
---|
36 | export declare const sendMessageToMaster: (msg: MessageFromWorker) => Promise<void>;
|
---|
37 | /**
|
---|
38 | * Send a message to a cluster worker.
|
---|
39 | * (This function should be invoked from the cluster master only.)
|
---|
40 | *
|
---|
41 | * @param workerId The ID of the recipient worker.
|
---|
42 | * @param msg The message to send to the worker.
|
---|
43 | * @return A promise that is resolved once the message has been sent.
|
---|
44 | */
|
---|
45 | export declare const sendMessageToWorker: (workerId: number, msg: MessageToWorker) => Promise<void>;
|
---|