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

Side by Side Diff: logdog/client/coordinator/query.go

Issue 2341113002: Update Coordinator client, add datagram assembly. (Closed)
Patch Set: Comments. Created 4 years, 3 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
« no previous file with comments | « logdog/client/coordinator/list.go ('k') | logdog/client/coordinator/query_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 coordinator 5 package coordinator
6 6
7 import ( 7 import (
8 "fmt"
8 "time" 9 "time"
9 10
10 "github.com/luci/luci-go/common/config" 11 "github.com/luci/luci-go/common/config"
11 "github.com/luci/luci-go/common/proto/google" 12 "github.com/luci/luci-go/common/proto/google"
12 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" 13 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1"
13 "github.com/luci/luci-go/logdog/api/logpb" 14 "github.com/luci/luci-go/logdog/api/logpb"
14 "github.com/luci/luci-go/logdog/common/types" 15 "github.com/luci/luci-go/logdog/common/types"
15 "golang.org/x/net/context" 16 "golang.org/x/net/context"
16 ) 17 )
17 18
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 149 }
149 150
150 // Iteratively query until either our query is done (Next is empty) or w e are 151 // Iteratively query until either our query is done (Next is empty) or w e are
151 // asked to stop via callback. 152 // asked to stop via callback.
152 for { 153 for {
153 resp, err := c.C.Query(ctx, &req) 154 resp, err := c.C.Query(ctx, &req)
154 if err != nil { 155 if err != nil {
155 return normalizeError(err) 156 return normalizeError(err)
156 } 157 }
157 158
158 » » for _, s := range resp.Streams { 159 » » for i, s := range resp.Streams {
159 » » » if !cb(loadLogStream(resp.Project, types.StreamPath(s.Pa th), s.State, s.Desc)) { 160 » » » st, err := loadLogStream(resp.Project, types.StreamPath( s.Path), s.State, s.Desc)
161 » » » if err != nil {
162 » » » » return fmt.Errorf("failed to load stream state # %d: %v", i, err)
163 » » » }
164
165 » » » if !cb(st) {
160 return nil 166 return nil
161 } 167 }
162 } 168 }
163 169
164 // Advance our query cursor. 170 // Advance our query cursor.
165 if resp.Next == "" { 171 if resp.Next == "" {
166 return nil 172 return nil
167 } 173 }
168 req.Next = resp.Next 174 req.Next = resp.Next
169 } 175 }
170 } 176 }
OLDNEW
« no previous file with comments | « logdog/client/coordinator/list.go ('k') | logdog/client/coordinator/query_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698