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

Side by Side Diff: logdog/client/cmd/logdog_cat/subcommandList.go

Issue 2341113002: Update Coordinator client, add datagram assembly. (Closed)
Patch Set: Comments. Created 4 years, 2 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. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "fmt" 9 "fmt"
10 "os" 10 "os"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return 1 101 return 1
102 } 102 }
103 } 103 }
104 return 0 104 return 0
105 } 105 }
106 106
107 func (*listCommandRun) attributes(lr *coordinator.ListResult) string { 107 func (*listCommandRun) attributes(lr *coordinator.ListResult) string {
108 var parts []string 108 var parts []string
109 109
110 if s := lr.State; s != nil { 110 if s := lr.State; s != nil {
111 » » if d := s.Desc; d != nil { 111 » » p := []string{
112 » » » p := []string{ 112 » » » s.Desc.GetTimestamp().Time().String(),
113 » » » » d.GetTimestamp().Time().String(), 113 » » » fmt.Sprintf("type:%s", s.Desc.StreamType.String()),
114 » » » » fmt.Sprintf("type:%s", d.StreamType.String()),
115 » » » }
116
117 » » » if t := d.GetTags(); len(t) > 0 {
118 » » » » tstr := make([]string, 0, len(t))
119 » » » » for k, v := range t {
120 » » » » » if v == "" {
121 » » » » » » tstr = append(tstr, k)
122 » » » » » } else {
123 » » » » » » tstr = append(tstr, fmt.Sprintf( "%s=%s", k, v))
124 » » » » » }
125 » » » » }
126 » » » » sort.Strings(tstr)
127 » » » » p = append(p, fmt.Sprintf("tags:{%s}", strings.J oin(tstr, ", ")))
128 » » » }
129
130 » » » parts = append(parts, p...)
131 } 114 }
132 115
133 » » if st := s.State; st != nil { 116 » » if t := s.Desc.GetTags(); len(t) > 0 {
134 » » » if st.TerminalIndex >= 0 { 117 » » » tstr := make([]string, 0, len(t))
135 » » » » parts = append(parts, fmt.Sprintf("terminal:%d", st.TerminalIndex)) 118 » » » for k, v := range t {
136 » » » } else { 119 » » » » if v == "" {
137 » » » » parts = append(parts, "streaming") 120 » » » » » tstr = append(tstr, k)
121 » » » » } else {
122 » » » » » tstr = append(tstr, fmt.Sprintf("%s=%s", k, v))
123 » » » » }
138 } 124 }
125 sort.Strings(tstr)
126 p = append(p, fmt.Sprintf("tags:{%s}", strings.Join(tstr , ", ")))
127 }
139 128
140 » » » if st.Archived { 129 » » parts = append(parts, p...)
141 » » » » parts = append(parts, "archived")
142 » » » }
143 130
144 » » » if st.Purged { 131 » » if s.State.TerminalIndex >= 0 {
145 » » » » parts = append(parts, "purged") 132 » » » parts = append(parts, fmt.Sprintf("terminal:%d", s.State .TerminalIndex))
146 » » » } 133 » » } else {
134 » » » parts = append(parts, "streaming")
135 » » }
136
137 » » if s.State.Archived {
138 » » » parts = append(parts, "archived")
139 » » }
140
141 » » if s.State.Purged {
142 » » » parts = append(parts, "purged")
147 } 143 }
148 } 144 }
149 145
150 return strings.Join(parts, " ") 146 return strings.Join(parts, " ")
151 } 147 }
OLDNEW
« no previous file with comments | « logdog/client/cmd/logdog_cat/coordinatorSource.go ('k') | logdog/client/cmd/logdog_cat/subcommandQuery.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698