Skip to content

Commit 171fea6

Browse files
feat: publish RateLimitInfo and FeatureFlag protos (#768)
* feat: publish RateLimitInfo and FeatureFlag protos PiperOrigin-RevId: 527878708 Source-Link: googleapis/googleapis@f129f48 Source-Link: googleapis/googleapis-gen@e02c87d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTAyYzg3ZDlkMGM5YTc3ZjJiMTcyNjhhODZmNDYyYjVhMWQ2NmJiZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: Add feature flag proto to BUILD file PiperOrigin-RevId: 528468347 Source-Link: googleapis/googleapis@38247e8 Source-Link: googleapis/googleapis-gen@17e62a1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTdlNjJhMWFiNWYyMmQ3ZDUzNzY3NWE2NTkxNTcyMDdlNDA2ZTYzZCJ9 * 🦉 Updates from OwlBot post-processor 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 b5d10d6 commit 171fea6

File tree

6 files changed

+129
-6
lines changed

6 files changed

+129
-6
lines changed

google/cloud/bigtable_v2/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .types.bigtable import MutateRowsResponse
3232
from .types.bigtable import PingAndWarmRequest
3333
from .types.bigtable import PingAndWarmResponse
34+
from .types.bigtable import RateLimitInfo
3435
from .types.bigtable import ReadChangeStreamRequest
3536
from .types.bigtable import ReadChangeStreamResponse
3637
from .types.bigtable import ReadModifyWriteRowRequest
@@ -54,6 +55,7 @@
5455
from .types.data import StreamPartition
5556
from .types.data import TimestampRange
5657
from .types.data import ValueRange
58+
from .types.feature_flags import FeatureFlags
5759
from .types.request_stats import FullReadStatsView
5860
from .types.request_stats import ReadIterationStats
5961
from .types.request_stats import RequestLatencyStats
@@ -69,6 +71,7 @@
6971
"Column",
7072
"ColumnRange",
7173
"Family",
74+
"FeatureFlags",
7275
"FullReadStatsView",
7376
"GenerateInitialChangeStreamPartitionsRequest",
7477
"GenerateInitialChangeStreamPartitionsResponse",
@@ -79,6 +82,7 @@
7982
"Mutation",
8083
"PingAndWarmRequest",
8184
"PingAndWarmResponse",
85+
"RateLimitInfo",
8286
"ReadChangeStreamRequest",
8387
"ReadChangeStreamResponse",
8488
"ReadIterationStats",

google/cloud/bigtable_v2/services/bigtable/async_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@ def read_rows(
242242
on the ``request`` instance; if ``request`` is provided, this
243243
should not be set.
244244
app_profile_id (:class:`str`):
245-
This value specifies routing for replication. This API
246-
only accepts the empty value of app_profile_id.
245+
This value specifies routing for
246+
replication. If not specified, the
247+
"default" application profile will be
248+
used.
247249
248250
This corresponds to the ``app_profile_id`` field
249251
on the ``request`` instance; if ``request`` is provided, this

google/cloud/bigtable_v2/services/bigtable/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,10 @@ def read_rows(
491491
on the ``request`` instance; if ``request`` is provided, this
492492
should not be set.
493493
app_profile_id (str):
494-
This value specifies routing for replication. This API
495-
only accepts the empty value of app_profile_id.
494+
This value specifies routing for
495+
replication. If not specified, the
496+
"default" application profile will be
497+
used.
496498
497499
This corresponds to the ``app_profile_id`` field
498500
on the ``request`` instance; if ``request`` is provided, this

google/cloud/bigtable_v2/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
MutateRowsResponse,
2525
PingAndWarmRequest,
2626
PingAndWarmResponse,
27+
RateLimitInfo,
2728
ReadChangeStreamRequest,
2829
ReadChangeStreamResponse,
2930
ReadModifyWriteRowRequest,
@@ -50,6 +51,9 @@
5051
TimestampRange,
5152
ValueRange,
5253
)
54+
from .feature_flags import (
55+
FeatureFlags,
56+
)
5357
from .request_stats import (
5458
FullReadStatsView,
5559
ReadIterationStats,
@@ -71,6 +75,7 @@
7175
"MutateRowsResponse",
7276
"PingAndWarmRequest",
7377
"PingAndWarmResponse",
78+
"RateLimitInfo",
7479
"ReadChangeStreamRequest",
7580
"ReadChangeStreamResponse",
7681
"ReadModifyWriteRowRequest",
@@ -94,6 +99,7 @@
9499
"StreamPartition",
95100
"TimestampRange",
96101
"ValueRange",
102+
"FeatureFlags",
97103
"FullReadStatsView",
98104
"ReadIterationStats",
99105
"RequestLatencyStats",

google/cloud/bigtable_v2/types/bigtable.py

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"MutateRowResponse",
3939
"MutateRowsRequest",
4040
"MutateRowsResponse",
41+
"RateLimitInfo",
4142
"CheckAndMutateRowRequest",
4243
"CheckAndMutateRowResponse",
4344
"PingAndWarmRequest",
@@ -61,8 +62,9 @@ class ReadRowsRequest(proto.Message):
6162
Values are of the form
6263
``projects/<project>/instances/<instance>/tables/<table>``.
6364
app_profile_id (str):
64-
This value specifies routing for replication. This API only
65-
accepts the empty value of app_profile_id.
65+
This value specifies routing for replication.
66+
If not specified, the "default" application
67+
profile will be used.
6668
rows (google.cloud.bigtable_v2.types.RowSet):
6769
The row keys and/or ranges to read
6870
sequentially. If not specified, reads from all
@@ -469,10 +471,19 @@ class Entry(proto.Message):
469471
class MutateRowsResponse(proto.Message):
470472
r"""Response message for BigtableService.MutateRows.
471473
474+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
475+
472476
Attributes:
473477
entries (MutableSequence[google.cloud.bigtable_v2.types.MutateRowsResponse.Entry]):
474478
One or more results for Entries from the
475479
batch request.
480+
rate_limit_info (google.cloud.bigtable_v2.types.RateLimitInfo):
481+
Information about how client should limit the
482+
rate (QPS). Primirily used by supported official
483+
Cloud Bigtable clients. If unset, the rate limit
484+
info is not provided by the server.
485+
486+
This field is a member of `oneof`_ ``_rate_limit_info``.
476487
"""
477488

478489
class Entry(proto.Message):
@@ -506,6 +517,50 @@ class Entry(proto.Message):
506517
number=1,
507518
message=Entry,
508519
)
520+
rate_limit_info: "RateLimitInfo" = proto.Field(
521+
proto.MESSAGE,
522+
number=3,
523+
optional=True,
524+
message="RateLimitInfo",
525+
)
526+
527+
528+
class RateLimitInfo(proto.Message):
529+
r"""Information about how client should adjust the load to
530+
Bigtable.
531+
532+
Attributes:
533+
period (google.protobuf.duration_pb2.Duration):
534+
Time that clients should wait before
535+
adjusting the target rate again. If clients
536+
adjust rate too frequently, the impact of the
537+
previous adjustment may not have been taken into
538+
account and may over-throttle or under-throttle.
539+
If clients adjust rate too slowly, they will not
540+
be responsive to load changes on server side,
541+
and may over-throttle or under-throttle.
542+
factor (float):
543+
If it has been at least one ``period`` since the last load
544+
adjustment, the client should multiply the current load by
545+
this value to get the new target load. For example, if the
546+
current load is 100 and ``factor`` is 0.8, the new target
547+
load should be 80. After adjusting, the client should ignore
548+
``factor`` until another ``period`` has passed.
549+
550+
The client can measure its load using any unit that's
551+
comparable over time For example, QPS can be used as long as
552+
each request involves a similar amount of work.
553+
"""
554+
555+
period: duration_pb2.Duration = proto.Field(
556+
proto.MESSAGE,
557+
number=1,
558+
message=duration_pb2.Duration,
559+
)
560+
factor: float = proto.Field(
561+
proto.DOUBLE,
562+
number=2,
563+
)
509564

510565

511566
class CheckAndMutateRowRequest(proto.Message):
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
from __future__ import annotations
17+
18+
from typing import MutableMapping, MutableSequence
19+
20+
import proto # type: ignore
21+
22+
23+
__protobuf__ = proto.module(
24+
package="google.bigtable.v2",
25+
manifest={
26+
"FeatureFlags",
27+
},
28+
)
29+
30+
31+
class FeatureFlags(proto.Message):
32+
r"""Feature flags supported by a client. This is intended to be sent as
33+
part of request metadata to assure the server that certain behaviors
34+
are safe to enable. This proto is meant to be serialized and
35+
websafe-base64 encoded under the ``bigtable-features`` metadata key.
36+
The value will remain constant for the lifetime of a client and due
37+
to HTTP2's HPACK compression, the request overhead will be tiny.
38+
This is an internal implementation detail and should not be used by
39+
endusers directly.
40+
41+
Attributes:
42+
mutate_rows_rate_limit (bool):
43+
Notify the server that the client enables
44+
batch write flow control by requesting
45+
RateLimitInfo from MutateRowsResponse.
46+
"""
47+
48+
mutate_rows_rate_limit: bool = proto.Field(
49+
proto.BOOL,
50+
number=3,
51+
)
52+
53+
54+
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)