UNPKG

faastjs

Version:

Serverless batch computing made simple.

48 lines (47 loc) 1.7 kB
/// <reference types="node" /> import { Writable } from "stream"; import { CostSnapshot } from "../cost"; import { PackerResult } from "../packer"; import { CommonOptions, FunctionStats, Message, ProviderImpl } from "../provider"; import { AsyncQueue } from "../throttle"; import { Wrapper, WrapperOptions } from "../wrapper"; interface Executor { wrapper: Wrapper; logUrl: string; logStream?: Writable; } /** * @public */ export interface LocalState { /** @internal */ executors: Executor[]; /** @internal */ getExecutor: () => Promise<Executor>; /** The temporary directory where the local function is deployed. */ tempDir: string; /** The file:// URL for the local function log file directory. */ logUrl: string; /** @internal */ gcPromise?: Promise<void>; /** @internal */ queue: AsyncQueue<Message>; /** Options used to initialize the local function. */ options: Required<LocalOptions>; } /** * Local provider options for {@link faastLocal}. * * @public */ export interface LocalOptions extends CommonOptions { /** @internal */ _gcWorker?: (tempdir: string) => Promise<void>; } export declare function defaultGcWorker(dir: string): Promise<void>; export declare const defaults: Required<LocalOptions>; export declare const LocalImpl: ProviderImpl<LocalOptions, LocalState>; export declare function logUrl(state: LocalState): string; export declare function localPacker(functionModule: string, options: CommonOptions, wrapperOptions: WrapperOptions, FunctionName: string): Promise<PackerResult>; export declare function costSnapshot(state: LocalState, stats: FunctionStats): Promise<CostSnapshot>; export {};