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