Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: common/gcloud/pubsub/connection.go

Issue 1838303002: Use native Pub/Sub library primitives. (Closed) Base URL: https://github.com/luci/luci-go@logdog-go1.6
Patch Set: Use "Topic" instead of "NewTopic" ... don't want to create :) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « common/gcloud/pubsub/ackbuffer/ackbuffer_test.go ('k') | common/gcloud/pubsub/connection_impl.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698