Skip to content

Commit c286b88

Browse files
garrettjonesgooglemziccard
authored andcommitted
Fixing doc problems, improving formatting
fixes googleapis#387 - Moving references of delete topics to get/list calls fixes googleapis#386 - Removing the problematic wording fixes googleapis#385 - Changing 'returns' to 'generates' when referencing errors
1 parent c160a25 commit c286b88

File tree

4 files changed

+54
-33
lines changed

4 files changed

+54
-33
lines changed

gcloud-java-pubsub/src/main/java/com/google/gcloud/pubsub/spi/PublisherApi.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public ApiCallable<Topic, Topic> createTopicCallable() {
447447

448448
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
449449
/**
450-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
450+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
451451
* does not exist. The message payload must not be empty; it must contain
452452
* either a non-empty data field, or at least one attribute.
453453
*
@@ -466,7 +466,7 @@ public PublishResponse publish(String topic, List<PubsubMessage> messages) {
466466

467467
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
468468
/**
469-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
469+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
470470
* does not exist. The message payload must not be empty; it must contain
471471
* either a non-empty data field, or at least one attribute.
472472
*
@@ -481,7 +481,7 @@ public PublishResponse publish(PublishRequest request) {
481481

482482
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
483483
/**
484-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
484+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
485485
* does not exist. The message payload must not be empty; it must contain
486486
* either a non-empty data field, or at least one attribute.
487487
*
@@ -659,7 +659,7 @@ public Iterable<String> listTopicSubscriptions(ListTopicSubscriptionsRequest req
659659

660660
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
661661
/**
662-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
662+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
663663
* does not exist. After a topic is deleted, a new topic may be created with
664664
* the same name; this is an entirely new topic with none of the old
665665
* configuration or subscriptions. Existing subscriptions to this topic are
@@ -678,7 +678,7 @@ public void deleteTopic(String topic) {
678678

679679
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
680680
/**
681-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
681+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
682682
* does not exist. After a topic is deleted, a new topic may be created with
683683
* the same name; this is an entirely new topic with none of the old
684684
* configuration or subscriptions. Existing subscriptions to this topic are
@@ -695,7 +695,7 @@ public void deleteTopic(DeleteTopicRequest request) {
695695

696696
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
697697
/**
698-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
698+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
699699
* does not exist. After a topic is deleted, a new topic may be created with
700700
* the same name; this is an entirely new topic with none of the old
701701
* configuration or subscriptions. Existing subscriptions to this topic are

gcloud-java-pubsub/src/main/java/com/google/gcloud/pubsub/spi/SubscriberApi.java

+34-16
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ public static final String extractSubscriptionFromSubscriptionPath(String subscr
382382
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
383383
/**
384384
* Creates a subscription to a given topic for a given subscriber.
385-
* If the subscription already exists, returns `ALREADY_EXISTS`.
386-
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
385+
* If the subscription already exists, generates `ALREADY_EXISTS`.
386+
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
387387
*
388388
* If the name is not provided in the request, the server will assign a random
389389
* name for this subscription on the same project as the topic.
@@ -398,8 +398,6 @@ public static final String extractSubscriptionFromSubscriptionPath(String subscr
398398
* plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
399399
* in length, and it must not start with `"goog"`.
400400
* @param topic The name of the topic from which this subscription is receiving messages.
401-
* The value of this field will be `_deleted-topic_` if the topic has been
402-
* deleted.
403401
* @param pushConfig If push delivery is used with this subscription, this field is
404402
* used to configure it. An empty `pushConfig` signifies that the subscriber
405403
* will pull and ack messages using API methods.
@@ -438,8 +436,8 @@ public Subscription createSubscription(
438436
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
439437
/**
440438
* Creates a subscription to a given topic for a given subscriber.
441-
* If the subscription already exists, returns `ALREADY_EXISTS`.
442-
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
439+
* If the subscription already exists, generates `ALREADY_EXISTS`.
440+
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
443441
*
444442
* If the name is not provided in the request, the server will assign a random
445443
* name for this subscription on the same project as the topic.
@@ -456,8 +454,8 @@ public Subscription createSubscription(Subscription request) {
456454
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
457455
/**
458456
* Creates a subscription to a given topic for a given subscriber.
459-
* If the subscription already exists, returns `ALREADY_EXISTS`.
460-
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
457+
* If the subscription already exists, generates `ALREADY_EXISTS`.
458+
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
461459
*
462460
* If the name is not provided in the request, the server will assign a random
463461
* name for this subscription on the same project as the topic.
@@ -481,6 +479,9 @@ public ApiCallable<Subscription, Subscription> createSubscriptionCallable() {
481479
/**
482480
* Gets the configuration details of a subscription.
483481
*
482+
* If the topic of a subscription has been deleted, the subscription itself is
483+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
484+
*
484485
* <!-- manual edit -->
485486
* <!-- end manual edit -->
486487
*
@@ -497,6 +498,9 @@ public Subscription getSubscription(String subscription) {
497498
/**
498499
* Gets the configuration details of a subscription.
499500
*
501+
* If the topic of a subscription has been deleted, the subscription itself is
502+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
503+
*
500504
* <!-- manual edit -->
501505
* <!-- end manual edit -->
502506
*
@@ -510,6 +514,9 @@ public Subscription getSubscription(GetSubscriptionRequest request) {
510514
/**
511515
* Gets the configuration details of a subscription.
512516
*
517+
* If the topic of a subscription has been deleted, the subscription itself is
518+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
519+
*
513520
* <!-- manual edit -->
514521
* <!-- end manual edit -->
515522
*/
@@ -529,6 +536,9 @@ public ApiCallable<GetSubscriptionRequest, Subscription> getSubscriptionCallable
529536
/**
530537
* Lists matching subscriptions.
531538
*
539+
* If the topic of a subscription has been deleted, the subscription itself is
540+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
541+
*
532542
* <!-- manual edit -->
533543
* <!-- end manual edit -->
534544
*/
@@ -542,6 +552,9 @@ public Iterable<Subscription> listSubscriptions(String project) {
542552
/**
543553
* Lists matching subscriptions.
544554
*
555+
* If the topic of a subscription has been deleted, the subscription itself is
556+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
557+
*
545558
* <!-- manual edit -->
546559
* <!-- end manual edit -->
547560
*
@@ -555,6 +568,9 @@ public Iterable<Subscription> listSubscriptions(ListSubscriptionsRequest request
555568
/**
556569
* Lists matching subscriptions.
557570
*
571+
* If the topic of a subscription has been deleted, the subscription itself is
572+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
573+
*
558574
* <!-- manual edit -->
559575
* <!-- end manual edit -->
560576
*/
@@ -567,6 +583,9 @@ public Iterable<Subscription> listSubscriptions(ListSubscriptionsRequest request
567583
/**
568584
* Lists matching subscriptions.
569585
*
586+
* If the topic of a subscription has been deleted, the subscription itself is
587+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
588+
*
570589
* <!-- manual edit -->
571590
* <!-- end manual edit -->
572591
*/
@@ -586,7 +605,7 @@ public Iterable<Subscription> listSubscriptions(ListSubscriptionsRequest request
586605
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
587606
/**
588607
* Deletes an existing subscription. All pending messages in the subscription
589-
* are immediately dropped. Calls to `Pull` after deletion will return
608+
* are immediately dropped. Calls to `Pull` after deletion will generate
590609
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
591610
* the same name, but the new one has no association with the old
592611
* subscription, or its topic unless the same topic is specified.
@@ -606,7 +625,7 @@ public void deleteSubscription(String subscription) {
606625
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
607626
/**
608627
* Deletes an existing subscription. All pending messages in the subscription
609-
* are immediately dropped. Calls to `Pull` after deletion will return
628+
* are immediately dropped. Calls to `Pull` after deletion will generate
610629
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
611630
* the same name, but the new one has no association with the old
612631
* subscription, or its topic unless the same topic is specified.
@@ -623,7 +642,7 @@ public void deleteSubscription(DeleteSubscriptionRequest request) {
623642
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
624643
/**
625644
* Deletes an existing subscription. All pending messages in the subscription
626-
* are immediately dropped. Calls to `Pull` after deletion will return
645+
* are immediately dropped. Calls to `Pull` after deletion will generate
627646
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
628647
* the same name, but the new one has no association with the old
629648
* subscription, or its topic unless the same topic is specified.
@@ -780,7 +799,7 @@ public ApiCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
780799
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
781800
/**
782801
* Pulls messages from the server. Returns an empty list if there are no
783-
* messages available in the backlog. The server may return `UNAVAILABLE` if
802+
* messages available in the backlog. The server may generate `UNAVAILABLE` if
784803
* there are too many concurrent pull requests pending for the given
785804
* subscription.
786805
*
@@ -791,8 +810,7 @@ public ApiCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
791810
* @param returnImmediately If this is specified as true the system will respond immediately even if
792811
* it is not able to return a message in the `Pull` response. Otherwise the
793812
* system is allowed to wait until at least one message is available rather
794-
* than returning no messages. The client may cancel the request if it does
795-
* not wish to wait any longer for the response.
813+
* than returning no messages.
796814
* @param maxMessages The maximum number of messages returned for this request. The Pub/Sub
797815
* system may return fewer than the number specified.
798816
*/
@@ -810,7 +828,7 @@ public PullResponse pull(String subscription, boolean returnImmediately, int max
810828
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
811829
/**
812830
* Pulls messages from the server. Returns an empty list if there are no
813-
* messages available in the backlog. The server may return `UNAVAILABLE` if
831+
* messages available in the backlog. The server may generate `UNAVAILABLE` if
814832
* there are too many concurrent pull requests pending for the given
815833
* subscription.
816834
*
@@ -826,7 +844,7 @@ public PullResponse pull(PullRequest request) {
826844
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
827845
/**
828846
* Pulls messages from the server. Returns an empty list if there are no
829-
* messages available in the backlog. The server may return `UNAVAILABLE` if
847+
* messages available in the backlog. The server may generate `UNAVAILABLE` if
830848
* there are too many concurrent pull requests pending for the given
831849
* subscription.
832850
*

gcloud-java-pubsub/src/main/java/com/google/gcloud/pubsub/spi/testing/LocalPublisherImpl.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public void getTopic(GetTopicRequest request, StreamObserver<Topic> responseObse
7474
}
7575

7676
@Override
77-
public void listTopics(ListTopicsRequest request, StreamObserver<ListTopicsResponse> responseObserver) {
77+
public void listTopics(
78+
ListTopicsRequest request, StreamObserver<ListTopicsResponse> responseObserver) {
7879
List<Topic> responseTopics = new ArrayList<>();
7980
for (String topicName : topics.keySet()) {
8081
String projectOfTopic = PublisherApi.extractProjectFromTopicPath(topicName);
@@ -84,11 +85,14 @@ public void listTopics(ListTopicsRequest request, StreamObserver<ListTopicsRespo
8485
responseTopics.add(topicObj);
8586
}
8687
}
87-
Collections.sort(responseTopics, new Comparator<Topic>() {
88-
@Override public int compare(Topic o1, Topic o2) {
89-
return o1.getName().compareTo(o2.getName());
90-
}
91-
});
88+
Collections.sort(
89+
responseTopics,
90+
new Comparator<Topic>() {
91+
@Override
92+
public int compare(Topic o1, Topic o2) {
93+
return o1.getName().compareTo(o2.getName());
94+
}
95+
});
9296
ListTopicsResponse.Builder response = ListTopicsResponse.newBuilder();
9397
response.setNextPageToken("");
9498
response.addAllTopics(responseTopics);
@@ -97,7 +101,8 @@ public void listTopics(ListTopicsRequest request, StreamObserver<ListTopicsRespo
97101
}
98102

99103
@Override
100-
public void listTopicSubscriptions(ListTopicSubscriptionsRequest request,
104+
public void listTopicSubscriptions(
105+
ListTopicSubscriptionsRequest request,
101106
StreamObserver<ListTopicSubscriptionsResponse> responseObserver) {
102107
responseObserver.onNext(ListTopicSubscriptionsResponse.getDefaultInstance());
103108
responseObserver.onCompleted();

gcloud-java-pubsub/src/main/java/com/google/gcloud/pubsub/testing/LocalPubsubHelper.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public class LocalPubsubHelper {
6161
public LocalPubsubHelper() throws MalformedURLException {
6262
gcloudCommand = new ArrayList<>(Arrays.asList(GCLOUD_CMD_TEXT.split(" ")));
6363
gcloudCommand.add(DEFAULT_HOST);
64-
emulatorUrl =
65-
new URL("http://storage.googleapis.com/pubsub/tools/" + FILENAME);
64+
emulatorUrl = new URL("http://storage.googleapis.com/pubsub/tools/" + FILENAME);
6665
GCloudEmulatorRunner gcloudRunner =
6766
new GCloudEmulatorRunner(gcloudCommand, VERSION_PREFIX, MIN_VERSION);
6867
DownloadableEmulatorRunner downloadRunner =
@@ -105,8 +104,7 @@ public void stop() throws IOException, InterruptedException {
105104
* Creates a channel for making requests to the in-memory service.
106105
*/
107106
public ManagedChannel createChannel() {
108-
return NettyChannelBuilder
109-
.forAddress(DEFAULT_HOST, DEFAULT_PORT)
107+
return NettyChannelBuilder.forAddress(DEFAULT_HOST, DEFAULT_PORT)
110108
.negotiationType(NegotiationType.PLAINTEXT)
111109
.build();
112110
}

0 commit comments

Comments
 (0)