UNPKG

1.69 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Writable } from "stream";
3import { CostSnapshot } from "../cost";
4import { PackerResult } from "../packer";
5import { CommonOptions, FunctionStats, Message, ProviderImpl } from "../provider";
6import { AsyncQueue } from "../throttle";
7import { Wrapper, WrapperOptions } from "../wrapper";
8interface Executor {
9 wrapper: Wrapper;
10 logUrl: string;
11 logStream?: Writable;
12}
13/**
14 * @public
15 */
16export interface LocalState {
17 /** @internal */
18 executors: Executor[];
19 /** @internal */
20 getExecutor: () => Executor;
21 /** The temporary directory where the local function is deployed. */
22 tempDir: string;
23 /** The file:// URL for the local function log file directory. */
24 logUrl: string;
25 /** @internal */
26 gcPromise?: Promise<void>;
27 /** @internal */
28 queue: AsyncQueue<Message>;
29 /** Options used to initialize the local function. */
30 options: Required<LocalOptions>;
31}
32/**
33 * Local provider options for {@link faastLocal}.
34 *
35 * @public
36 */
37export interface LocalOptions extends CommonOptions {
38 /** @internal */
39 _gcWorker?: (tempdir: string) => Promise<void>;
40}
41export declare function defaultGcWorker(dir: string): Promise<void>;
42export declare const defaults: Required<LocalOptions>;
43export declare const LocalImpl: ProviderImpl<LocalOptions, LocalState>;
44export declare function logUrl(state: LocalState): string;
45export declare function localPacker(functionModule: string, options: CommonOptions, wrapperOptions: WrapperOptions, FunctionName: string): Promise<PackerResult>;
46export declare function costSnapshot(state: LocalState, stats: FunctionStats): Promise<CostSnapshot>;
47export {};