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

Commit 199d56a

Browse files
feat: add StreamingPullRequest.client_id field (via synth)
Additionally, the copyright year is bumped to 2020 in some of the files.
1 parent b4ffb3f commit 199d56a

14 files changed

Lines changed: 139 additions & 97 deletions

google/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

google/cloud/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

google/cloud/pubsub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

google/cloud/pubsub_v1/gapic/publisher_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -51,10 +51,10 @@
5151

5252

5353
# TODO: remove conditional import after Python 2 support is dropped
54-
if six.PY3:
55-
from collections.abc import Mapping
56-
else:
54+
if six.PY2:
5755
from collections import Mapping
56+
else:
57+
from collections.abc import Mapping
5858

5959

6060
def _merge_dict(d1, d2):

google/cloud/pubsub_v1/gapic/subscriber_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -1307,11 +1307,11 @@ def create_snapshot(
13071307
>>> response = client.create_snapshot(name, subscription)
13081308
13091309
Args:
1310-
name (str): Optional user-provided name for this snapshot. If the name is not
1311-
provided in the request, the server will assign a random name for this
1312-
snapshot on the same project as the subscription. Note that for REST API
1313-
requests, you must specify a name. See the resource name rules. Format
1314-
is ``projects/{project}/snapshots/{snap}``.
1310+
name (str): User-provided name for this snapshot. If the name is not provided in the
1311+
request, the server will assign a random name for this snapshot on the
1312+
same project as the subscription. Note that for REST API requests, you
1313+
must specify a name. See the resource name rules. Format is
1314+
``projects/{project}/snapshots/{snap}``.
13151315
subscription (str): The subscription whose backlog the snapshot retains. Specifically, the
13161316
created snapshot is guaranteed to retain: (a) The existing backlog on
13171317
the subscription. More precisely, this is defined as the messages in the

google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

google/cloud/pubsub_v1/proto/pubsub.proto

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ message PubsubMessage {
164164
// at least one attribute.
165165
bytes data = 1;
166166

167-
// Optional attributes for this message.
167+
// Attributes for this message. If this field is empty, the message must
168+
// contain non-empty data.
168169
map<string, string> attributes = 2;
169170

170171
// ID of this message, assigned by the server when the message is published.
@@ -178,10 +179,12 @@ message PubsubMessage {
178179
// publisher in a `Publish` call.
179180
google.protobuf.Timestamp publish_time = 4;
180181

181-
// Identifies related messages for which publish order should be respected.
182-
// If a `Subscription` has `enable_message_ordering` set to `true`, messages
183-
// published with the same `ordering_key` value will be delivered to
184-
// subscribers in the order in which they are received by the Pub/Sub system.
182+
// If non-empty, identifies related messages for which publish order should be
183+
// respected. If a `Subscription` has `enable_message_ordering` set to `true`,
184+
// messages published with the same non-empty `ordering_key` value will be
185+
// delivered to subscribers in the order in which they are received by the
186+
// Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
187+
// must specify the same `ordering_key` value.
185188
// <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
186189
// API might be changed in backward-incompatible ways and is not recommended
187190
// for production use. It is not subject to any SLA or deprecation policy.
@@ -922,6 +925,14 @@ message StreamingPullRequest {
922925
// requests from client to server. The minimum deadline you can specify is 10
923926
// seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
924927
int32 stream_ack_deadline_seconds = 5;
928+
929+
// A unique identifier that is used to distinguish client instances from each
930+
// other. Only needs to be provided on the initial request. When a stream
931+
// disconnects and reconnects for the same stream, the client_id should be set
932+
// to the same value so that state associated with the old stream can be
933+
// transferred to the new stream. The same client_id should not be used for
934+
// different client instances.
935+
string client_id = 6;
925936
}
926937

927938
// Response for the `StreamingPull` method. This response is used to stream
@@ -933,13 +944,12 @@ message StreamingPullResponse {
933944

934945
// Request for the `CreateSnapshot` method.
935946
message CreateSnapshotRequest {
936-
// Optional user-provided name for this snapshot.
937-
// If the name is not provided in the request, the server will assign a random
938-
// name for this snapshot on the same project as the subscription.
939-
// Note that for REST API requests, you must specify a name. See the
940-
// <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
941-
// resource name rules</a>.
942-
// Format is `projects/{project}/snapshots/{snap}`.
947+
// User-provided name for this snapshot. If the name is not provided in the
948+
// request, the server will assign a random name for this snapshot on the same
949+
// project as the subscription. Note that for REST API requests, you must
950+
// specify a name. See the <a
951+
// href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
952+
// name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
943953
string name = 1;
944954

945955
// The subscription whose backlog the snapshot retains.

google/cloud/pubsub_v1/proto/pubsub_pb2.py

Lines changed: 93 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

noxfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def default(session):
7272
session.run(
7373
"py.test",
7474
"--quiet",
75+
"--cov=google.cloud.pubsub",
7576
"--cov=google.cloud",
7677
"--cov=tests.unit",
7778
"--cov-append",
@@ -110,7 +111,7 @@ def system(session):
110111
# Install all test dependencies, then install this package into the
111112
# virtualenv's dist-packages.
112113
session.install("mock", "pytest")
113-
# session.install("-e", "../test_utils/")
114+
114115
session.install("-e", "test_utils")
115116
session.install("-e", ".")
116117

0 commit comments

Comments
 (0)