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

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

Issue 2989333002: [logdog] Replace Tumble with push queues. (Closed)
Patch Set: comments Created 3 years, 4 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
1 // Copyright 2015 The LUCI Authors. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 package pubsub 15 package pubsub
16 16
17 import ( 17 import (
18 "flag" 18 "flag"
19
20 "cloud.google.com/go/pubsub"
21 ) 19 )
22 20
23 // Topic is a fully-qualified Pub/Sub project/topic name. 21 // Topic is a fully-qualified Pub/Sub project/topic name.
24 type Topic string 22 type Topic string
25 23
26 var _ flag.Value = (*Topic)(nil) 24 var _ flag.Value = (*Topic)(nil)
27 25
28 // NewTopic generates a new Topic for a given project and topic name. 26 // NewTopic generates a new Topic for a given project and topic name.
29 func NewTopic(project, name string) Topic { 27 func NewTopic(project, name string) Topic {
30 return Topic(newResource(project, "topics", name)) 28 return Topic(newResource(project, "topics", name))
(...skipping 23 matching lines...) Expand all
54 func (t Topic) Split() (p, n string) { 52 func (t Topic) Split() (p, n string) {
55 p, n, _ = t.SplitErr() 53 p, n, _ = t.SplitErr()
56 return 54 return
57 } 55 }
58 56
59 // SplitErr returns the Topic's project and name components. 57 // SplitErr returns the Topic's project and name components.
60 func (t Topic) SplitErr() (p, n string, err error) { 58 func (t Topic) SplitErr() (p, n string, err error) {
61 p, n, err = resourceProjectName(string(t)) 59 p, n, err = resourceProjectName(string(t))
62 return 60 return
63 } 61 }
64
65 // DisableTopicBundling configures a new pubsub.Topic to not bundle its data.
66 //
67 // t must NOT have had any Publish calls made yet, else these settings will not
68 // have any effect.
69 //
70 // By default, a Pub/Sub Topic bundles data, delaying its actual dispatch in
71 // favor of batching calls. Sometimes this is not desired. This function
72 // configures an existing Topic not to bundle.
73 func DisableTopicBundling(t *pubsub.Topic) {
74 t.PublishSettings.DelayThreshold = 0
75 t.PublishSettings.NumGoroutines = 1
76 t.PublishSettings.CountThreshold = 1
77 }
OLDNEW
« no previous file with comments | « common/gcloud/pubsub/publisher.go ('k') | logdog/api/endpoints/coordinator/services/v1/pb.discovery.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698