1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | import { RequestCallback, Table, InsertStreamOptions } from '.';
|
17 | import bigquery from './types';
|
18 | import { RowBatch } from './rowBatch';
|
19 | import { Stream } from 'stream';
|
20 | import { RowBatchOptions, InsertRowsOptions, RowMetadata } from './table';
|
21 | export interface MaxInsertOptions {
|
22 | maxOutstandingRows: number;
|
23 | maxOutstandingBytes: number;
|
24 | maxDelayMillis: number;
|
25 | }
|
26 | export declare const defaultOptions: MaxInsertOptions;
|
27 | export type InsertRowsStreamResponse = bigquery.ITableDataInsertAllResponse;
|
28 | export type InsertRowsCallback = RequestCallback<bigquery.ITableDataInsertAllResponse | bigquery.ITable>;
|
29 | export interface InsertRow {
|
30 | insertId?: string;
|
31 | json?: bigquery.IJsonObject;
|
32 | }
|
33 | export type TableRow = bigquery.ITableRow;
|
34 | export interface PartialInsertFailure {
|
35 | message: string;
|
36 | reason: string;
|
37 | row: RowMetadata;
|
38 | }
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | export declare class RowQueue {
|
48 | table: Table;
|
49 | stream: Stream;
|
50 | insertRowsOptions: InsertRowsOptions;
|
51 | batch: RowBatch;
|
52 | batchOptions?: RowBatchOptions;
|
53 | inFlight: boolean;
|
54 | pending?: ReturnType<typeof setTimeout>;
|
55 | constructor(table: Table, dup: Stream, options?: InsertStreamOptions);
|
56 | /**
|
57 | * Adds a row to the queue.
|
58 | *
|
59 | * @param {RowMetadata} row The row to insert.
|
60 | * @param {InsertRowsCallback} callback The insert callback.
|
61 | */
|
62 | add(row: RowMetadata, callback: InsertRowsCallback): void;
|
63 | |
64 |
|
65 |
|
66 | insert(callback?: InsertRowsCallback): void;
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | _insert(rows: RowMetadata | RowMetadata[], callbacks: InsertRowsCallback[], cb?: InsertRowsCallback): void;
|
75 | |
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | setOptions(options?: RowBatchOptions): void;
|
82 | getOptionDefaults(): RowBatchOptions;
|
83 | }
|