Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit b6fec4c

Browse files
fix: manual generate library for ongoing stream on closed client (#1011)
* fix: manual generate library for ongoing stream on closed client * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 83a0ffe commit b6fec4c

3 files changed

Lines changed: 424 additions & 2 deletions

File tree

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
{
2+
"clientLibrary": {
3+
"name": "nodejs-bigtable",
4+
"version": "0.1.0",
5+
"language": "TYPESCRIPT",
6+
"apis": [
7+
{
8+
"id": "google.bigtable.v2",
9+
"version": "v2"
10+
}
11+
]
12+
},
13+
"snippets": [
14+
{
15+
"regionTag": "bigtable_v2_generated_Bigtable_ReadRows_async",
16+
"title": "bigtable readRows Sample",
17+
"origin": "API_DEFINITION",
18+
"description": " Streams back the contents of all requested rows in key order, optionally applying the same Reader filter to each. Depending on their size, rows and cells may be broken up across multiple responses, but atomicity of each row will still be preserved. See the ReadRowsResponse documentation for details.",
19+
"canonical": true,
20+
"file": "bigtable.read_rows.js",
21+
"language": "JAVASCRIPT",
22+
"segments": [
23+
{
24+
"start": 20,
25+
"end": 69,
26+
"type": "FULL"
27+
}
28+
],
29+
"clientMethod": {
30+
"shortName": "ReadRows",
31+
"fullName": "google.bigtable.v2.Bigtable.ReadRows",
32+
"async": true,
33+
"parameters": [
34+
{
35+
"name": "table_name",
36+
"type": "TYPE_STRING"
37+
},
38+
{
39+
"name": "app_profile_id",
40+
"type": "TYPE_STRING"
41+
},
42+
{
43+
"name": "rows",
44+
"type": ".google.bigtable.v2.RowSet"
45+
},
46+
{
47+
"name": "filter",
48+
"type": ".google.bigtable.v2.RowFilter"
49+
},
50+
{
51+
"name": "rows_limit",
52+
"type": "TYPE_INT64"
53+
}
54+
],
55+
"resultType": ".google.bigtable.v2.ReadRowsResponse",
56+
"client": {
57+
"shortName": "BigtableClient",
58+
"fullName": "google.bigtable.v2.BigtableClient"
59+
},
60+
"method": {
61+
"shortName": "ReadRows",
62+
"fullName": "google.bigtable.v2.Bigtable.ReadRows",
63+
"service": {
64+
"shortName": "Bigtable",
65+
"fullName": "google.bigtable.v2.Bigtable"
66+
}
67+
}
68+
}
69+
},
70+
{
71+
"regionTag": "bigtable_v2_generated_Bigtable_SampleRowKeys_async",
72+
"title": "bigtable sampleRowKeys Sample",
73+
"origin": "API_DEFINITION",
74+
"description": " Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.",
75+
"canonical": true,
76+
"file": "bigtable.sample_row_keys.js",
77+
"language": "JAVASCRIPT",
78+
"segments": [
79+
{
80+
"start": 20,
81+
"end": 54,
82+
"type": "FULL"
83+
}
84+
],
85+
"clientMethod": {
86+
"shortName": "SampleRowKeys",
87+
"fullName": "google.bigtable.v2.Bigtable.SampleRowKeys",
88+
"async": true,
89+
"parameters": [
90+
{
91+
"name": "table_name",
92+
"type": "TYPE_STRING"
93+
},
94+
{
95+
"name": "app_profile_id",
96+
"type": "TYPE_STRING"
97+
}
98+
],
99+
"resultType": ".google.bigtable.v2.SampleRowKeysResponse",
100+
"client": {
101+
"shortName": "BigtableClient",
102+
"fullName": "google.bigtable.v2.BigtableClient"
103+
},
104+
"method": {
105+
"shortName": "SampleRowKeys",
106+
"fullName": "google.bigtable.v2.Bigtable.SampleRowKeys",
107+
"service": {
108+
"shortName": "Bigtable",
109+
"fullName": "google.bigtable.v2.Bigtable"
110+
}
111+
}
112+
}
113+
},
114+
{
115+
"regionTag": "bigtable_v2_generated_Bigtable_MutateRow_async",
116+
"title": "bigtable mutateRow Sample",
117+
"origin": "API_DEFINITION",
118+
"description": " Mutates a row atomically. Cells already present in the row are left unchanged unless explicitly changed by `mutation`.",
119+
"canonical": true,
120+
"file": "bigtable.mutate_row.js",
121+
"language": "JAVASCRIPT",
122+
"segments": [
123+
{
124+
"start": 20,
125+
"end": 64,
126+
"type": "FULL"
127+
}
128+
],
129+
"clientMethod": {
130+
"shortName": "MutateRow",
131+
"fullName": "google.bigtable.v2.Bigtable.MutateRow",
132+
"async": true,
133+
"parameters": [
134+
{
135+
"name": "table_name",
136+
"type": "TYPE_STRING"
137+
},
138+
{
139+
"name": "app_profile_id",
140+
"type": "TYPE_STRING"
141+
},
142+
{
143+
"name": "row_key",
144+
"type": "TYPE_BYTES"
145+
},
146+
{
147+
"name": "mutations",
148+
"type": "TYPE_MESSAGE[]"
149+
}
150+
],
151+
"resultType": ".google.bigtable.v2.MutateRowResponse",
152+
"client": {
153+
"shortName": "BigtableClient",
154+
"fullName": "google.bigtable.v2.BigtableClient"
155+
},
156+
"method": {
157+
"shortName": "MutateRow",
158+
"fullName": "google.bigtable.v2.Bigtable.MutateRow",
159+
"service": {
160+
"shortName": "Bigtable",
161+
"fullName": "google.bigtable.v2.Bigtable"
162+
}
163+
}
164+
}
165+
},
166+
{
167+
"regionTag": "bigtable_v2_generated_Bigtable_MutateRows_async",
168+
"title": "bigtable mutateRows Sample",
169+
"origin": "API_DEFINITION",
170+
"description": " Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically.",
171+
"canonical": true,
172+
"file": "bigtable.mutate_rows.js",
173+
"language": "JAVASCRIPT",
174+
"segments": [
175+
{
176+
"start": 20,
177+
"end": 61,
178+
"type": "FULL"
179+
}
180+
],
181+
"clientMethod": {
182+
"shortName": "MutateRows",
183+
"fullName": "google.bigtable.v2.Bigtable.MutateRows",
184+
"async": true,
185+
"parameters": [
186+
{
187+
"name": "table_name",
188+
"type": "TYPE_STRING"
189+
},
190+
{
191+
"name": "app_profile_id",
192+
"type": "TYPE_STRING"
193+
},
194+
{
195+
"name": "entries",
196+
"type": "TYPE_MESSAGE[]"
197+
}
198+
],
199+
"resultType": ".google.bigtable.v2.MutateRowsResponse",
200+
"client": {
201+
"shortName": "BigtableClient",
202+
"fullName": "google.bigtable.v2.BigtableClient"
203+
},
204+
"method": {
205+
"shortName": "MutateRows",
206+
"fullName": "google.bigtable.v2.Bigtable.MutateRows",
207+
"service": {
208+
"shortName": "Bigtable",
209+
"fullName": "google.bigtable.v2.Bigtable"
210+
}
211+
}
212+
}
213+
},
214+
{
215+
"regionTag": "bigtable_v2_generated_Bigtable_CheckAndMutateRow_async",
216+
"title": "bigtable checkAndMutateRow Sample",
217+
"origin": "API_DEFINITION",
218+
"description": " Mutates a row atomically based on the output of a predicate Reader filter.",
219+
"canonical": true,
220+
"file": "bigtable.check_and_mutate_row.js",
221+
"language": "JAVASCRIPT",
222+
"segments": [
223+
{
224+
"start": 20,
225+
"end": 81,
226+
"type": "FULL"
227+
}
228+
],
229+
"clientMethod": {
230+
"shortName": "CheckAndMutateRow",
231+
"fullName": "google.bigtable.v2.Bigtable.CheckAndMutateRow",
232+
"async": true,
233+
"parameters": [
234+
{
235+
"name": "table_name",
236+
"type": "TYPE_STRING"
237+
},
238+
{
239+
"name": "app_profile_id",
240+
"type": "TYPE_STRING"
241+
},
242+
{
243+
"name": "row_key",
244+
"type": "TYPE_BYTES"
245+
},
246+
{
247+
"name": "predicate_filter",
248+
"type": ".google.bigtable.v2.RowFilter"
249+
},
250+
{
251+
"name": "true_mutations",
252+
"type": "TYPE_MESSAGE[]"
253+
},
254+
{
255+
"name": "false_mutations",
256+
"type": "TYPE_MESSAGE[]"
257+
}
258+
],
259+
"resultType": ".google.bigtable.v2.CheckAndMutateRowResponse",
260+
"client": {
261+
"shortName": "BigtableClient",
262+
"fullName": "google.bigtable.v2.BigtableClient"
263+
},
264+
"method": {
265+
"shortName": "CheckAndMutateRow",
266+
"fullName": "google.bigtable.v2.Bigtable.CheckAndMutateRow",
267+
"service": {
268+
"shortName": "Bigtable",
269+
"fullName": "google.bigtable.v2.Bigtable"
270+
}
271+
}
272+
}
273+
},
274+
{
275+
"regionTag": "bigtable_v2_generated_Bigtable_ReadModifyWriteRow_async",
276+
"title": "bigtable readModifyWriteRow Sample",
277+
"origin": "API_DEFINITION",
278+
"description": " Modifies a row atomically on the server. The method reads the latest existing timestamp and value from the specified columns and writes a new entry based on pre-defined read/modify/write rules. The new value for the timestamp is the greater of the existing timestamp or the current server time. The method returns the new contents of all modified cells.",
279+
"canonical": true,
280+
"file": "bigtable.read_modify_write_row.js",
281+
"language": "JAVASCRIPT",
282+
"segments": [
283+
{
284+
"start": 20,
285+
"end": 65,
286+
"type": "FULL"
287+
}
288+
],
289+
"clientMethod": {
290+
"shortName": "ReadModifyWriteRow",
291+
"fullName": "google.bigtable.v2.Bigtable.ReadModifyWriteRow",
292+
"async": true,
293+
"parameters": [
294+
{
295+
"name": "table_name",
296+
"type": "TYPE_STRING"
297+
},
298+
{
299+
"name": "app_profile_id",
300+
"type": "TYPE_STRING"
301+
},
302+
{
303+
"name": "row_key",
304+
"type": "TYPE_BYTES"
305+
},
306+
{
307+
"name": "rules",
308+
"type": "TYPE_MESSAGE[]"
309+
}
310+
],
311+
"resultType": ".google.bigtable.v2.ReadModifyWriteRowResponse",
312+
"client": {
313+
"shortName": "BigtableClient",
314+
"fullName": "google.bigtable.v2.BigtableClient"
315+
},
316+
"method": {
317+
"shortName": "ReadModifyWriteRow",
318+
"fullName": "google.bigtable.v2.Bigtable.ReadModifyWriteRow",
319+
"service": {
320+
"shortName": "Bigtable",
321+
"fullName": "google.bigtable.v2.Bigtable"
322+
}
323+
}
324+
}
325+
}
326+
]
327+
}

src/v2/bigtable_client.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@
1818

1919
/* global window */
2020
import * as gax from 'google-gax';
21-
import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
22-
21+
import {
22+
Callback,
23+
CallOptions,
24+
Descriptors,
25+
ClientOptions,
26+
GoogleError,
27+
} from 'google-gax';
28+
29+
import {PassThrough} from 'stream';
2330
import * as protos from '../../protos/protos';
2431
import jsonProtos = require('../../protos/protos.json');
2532
/**
@@ -236,6 +243,16 @@ export class BigtableClient {
236243
stub =>
237244
(...args: Array<{}>) => {
238245
if (this._terminated) {
246+
if (methodName in this.descriptors.stream) {
247+
const stream = new PassThrough();
248+
setImmediate(() => {
249+
stream.emit(
250+
'error',
251+
new GoogleError('The client has already been closed.')
252+
);
253+
});
254+
return stream;
255+
}
239256
return Promise.reject('The client has already been closed.');
240257
}
241258
const func = stub[methodName];

0 commit comments

Comments
 (0)