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

Unified Diff: logdog/client/butler/bundler/bundler.go

Issue 2601583002: Butler: fix global tags applied to empty map. (Closed)
Patch Set: Added tests, testing method to Bundler. Created 4 years 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 | « no previous file | logdog/client/butler/bundler/stream.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/client/butler/bundler/bundler.go
diff --git a/logdog/client/butler/bundler/bundler.go b/logdog/client/butler/bundler/bundler.go
index eaff529d4062a5fc8a3434a770616d2229a80255..f6cb3e9f3a7f63ed6836ff8757aea05524b20a4f 100644
--- a/logdog/client/butler/bundler/bundler.go
+++ b/logdog/client/butler/bundler/bundler.go
@@ -52,6 +52,7 @@ type bundlerStream interface {
name() string
expireTime() (time.Time, bool)
nextBundleEntry(*builder, bool) bool
+ streamDesc() *logpb.LogStreamDescriptor
}
// Bundler is the main Bundler instance. It exposes goroutine-safe endpoints for
@@ -141,6 +142,26 @@ func (b *Bundler) Register(p *streamproto.Properties) (Stream, error) {
return s, nil
}
+// GetStreamDescs returns the set of registered stream names mapped to their
+// descriptors.
+//
+// This is intended for testing purposes. DO NOT modify the resulting
+// descriptors.
+func (b *Bundler) GetStreamDescs() map[string]*logpb.LogStreamDescriptor {
+ b.streamsLock.Lock()
+ defer b.streamsLock.Unlock()
+
+ if len(b.streams) == 0 {
+ return nil
+ }
+
+ streams := make(map[string]*logpb.LogStreamDescriptor, len(b.streams))
+ for k, s := range b.streams {
+ streams[k] = s.streamDesc()
+ }
+ return streams
+}
+
// CloseAndFlush closes the Bundler, alerting it that no more streams will be
// added and that existing data may be aggressively output.
//
« no previous file with comments | « no previous file | logdog/client/butler/bundler/stream.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698