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