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

Unified Diff: common/gcloud/pubsub/ackbuffer/ack.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
Index: common/gcloud/pubsub/ackbuffer/ack.go
diff --git a/common/gcloud/pubsub/ackbuffer/ack.go b/common/gcloud/pubsub/ackbuffer/ack.go
deleted file mode 100644
index 115e302794207500454e37ebcef9f4c468deccbf..0000000000000000000000000000000000000000
--- a/common/gcloud/pubsub/ackbuffer/ack.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 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 ackbuffer
-
-import (
- "github.com/luci/luci-go/common/gcloud/pubsub"
- "golang.org/x/net/context"
-)
-
-// Acknowledger sends ACKs to a Pub/Sub interface.
-type Acknowledger interface {
- // Ack acknowledges one or more Pub/Sub message ACK IDs.
- Ack(ctx context.Context, ackIDs ...string) error
-
- // AckBatchSize returns the maximum number of ACKs that can be sent at a time.
- AckBatchSize() int
-}
-
-type pubsubACK struct {
- ps pubsub.Connection
- sub pubsub.Subscription
- batch int
-}
-
-// NewACK creates a Acknowledger instance from a pubsub.Connection
-// implementation.
-//
-// If batch is <= 0, the maximum ACK batch size will be used.
-func NewACK(ps pubsub.Connection, s pubsub.Subscription, batch int) Acknowledger {
- if batch <= 0 {
- batch = pubsub.MaxMessageAckPerRequest
- }
-
- return &pubsubACK{
- ps: ps,
- sub: s,
- batch: batch,
- }
-}
-
-func (a *pubsubACK) Ack(c context.Context, ackIDs ...string) error {
- return a.ps.Ack(c, a.sub, ackIDs...)
-}
-
-func (a *pubsubACK) AckBatchSize() int {
- return a.batch
-}
« no previous file with comments | « client/internal/logdog/butler/output/pubsub/pubsubOutput_test.go ('k') | common/gcloud/pubsub/ackbuffer/ackbuffer.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698