| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package pubsub | |
| 6 | |
| 7 import ( | |
| 8 "golang.org/x/net/context" | |
| 9 "google.golang.org/cloud/pubsub" | |
| 10 ) | |
| 11 | |
| 12 var ( | |
| 13 // PublisherScopes is the set of OAuth2 scopes needed for a publisher to | |
| 14 // publish messages. | |
| 15 PublisherScopes = []string{ | |
| 16 pubsub.ScopePubSub, | |
| 17 } | |
| 18 | |
| 19 // SubscriberScopes is the set of OAuth2 scopes needed for a subscriber
to | |
| 20 // pull and acknowledge messages. | |
| 21 SubscriberScopes = []string{ | |
| 22 pubsub.ScopePubSub, | |
| 23 } | |
| 24 ) | |
| 25 | |
| 26 // Connection is an interface to a Pub/Sub connection. | |
| 27 // | |
| 28 // Any method may return an errors.TransientError to indicate that the | |
| 29 // encountered error was transient. | |
| 30 type Connection interface { | |
| 31 // TopicExists tests if a given Topic exists. | |
| 32 TopicExists(context.Context, Topic) (bool, error) | |
| 33 | |
| 34 // SubscriptionExists tests if a given Subscription exists. | |
| 35 SubExists(context.Context, Subscription) (bool, error) | |
| 36 | |
| 37 // Publish publishes a batch of Pub/Sub messages. | |
| 38 Publish(context.Context, Topic, ...*Message) ([]string, error) | |
| 39 | |
| 40 // Pull pulls messages from the subscription. It returns up the requeste
d | |
| 41 // number of messages. | |
| 42 Pull(context.Context, Subscription, int) ([]*Message, error) | |
| 43 | |
| 44 // Ack acknowledges one or more Pub/Sub message ACK IDs. | |
| 45 Ack(context.Context, Subscription, ...string) error | |
| 46 } | |
| OLD | NEW |