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

Unified Diff: common/gcloud/pubsub/subscriber/source.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, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/gcloud/pubsub/scopes.go ('k') | common/gcloud/pubsub/subscriber/subscriber.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/gcloud/pubsub/subscriber/source.go
diff --git a/common/gcloud/pubsub/subscriber/source.go b/common/gcloud/pubsub/subscriber/source.go
deleted file mode 100644
index e2212fd6a1ab6d232c62613c84bead1e3a09f824..0000000000000000000000000000000000000000
--- a/common/gcloud/pubsub/subscriber/source.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package subscriber
-
-import (
- "github.com/luci/luci-go/common/gcloud/pubsub"
- "golang.org/x/net/context"
-)
-
-// Source is used to pull Pub/Sub messages in batches.
-type Source interface {
- // Pull retrieves up to the specified number of of Pub/Sub messages to
- // process.
- Pull(context.Context, int) ([]*pubsub.Message, error)
-}
-
-// PubSubSource is a Source implementation built on top of a pubsub.PubSub.
-type pubSubSource struct {
- ps pubsub.Connection
- sub pubsub.Subscription
-}
-
-// NewSource generates a new Source by wrapping a pubsub.Connection
-// implementation. This Source is bound to a single subscription.
-func NewSource(ps pubsub.Connection, s pubsub.Subscription) Source {
- return &pubSubSource{
- ps: ps,
- sub: s,
- }
-}
-
-func (s *pubSubSource) Pull(c context.Context, batchSize int) (msgs []*pubsub.Message, err error) {
- return s.ps.Pull(c, s.sub, batchSize)
-}
« no previous file with comments | « common/gcloud/pubsub/scopes.go ('k') | common/gcloud/pubsub/subscriber/subscriber.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698