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

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

Issue 2697223002: Fix LogDog client queries without state. (Closed)
Patch Set: Created 3 years, 10 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/stream.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"
9 "time" 8 "time"
10 9
11 "github.com/luci/luci-go/common/proto/google" 10 "github.com/luci/luci-go/common/proto/google"
12 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" 11 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1"
13 "github.com/luci/luci-go/logdog/api/logpb" 12 "github.com/luci/luci-go/logdog/api/logpb"
14 "github.com/luci/luci-go/logdog/common/types" 13 "github.com/luci/luci-go/logdog/common/types"
15 "github.com/luci/luci-go/luci_config/common/cfgtypes" 14 "github.com/luci/luci-go/luci_config/common/cfgtypes"
16 15
17 "golang.org/x/net/context" 16 "golang.org/x/net/context"
18 ) 17 )
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 149 }
151 150
152 // 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
153 // asked to stop via callback. 152 // asked to stop via callback.
154 for { 153 for {
155 resp, err := c.C.Query(ctx, &req) 154 resp, err := c.C.Query(ctx, &req)
156 if err != nil { 155 if err != nil {
157 return normalizeError(err) 156 return normalizeError(err)
158 } 157 }
159 158
160 » » for i, s := range resp.Streams { 159 » » for _, s := range resp.Streams {
161 » » » st, err := loadLogStream(resp.Project, types.StreamPath( s.Path), s.State, s.Desc) 160 » » » st := loadLogStream(resp.Project, types.StreamPath(s.Pat h), s.State, s.Desc)
162 » » » if err != nil {
163 » » » » return fmt.Errorf("failed to load stream state # %d: %v", i, err)
164 » » » }
165
166 if !cb(st) { 161 if !cb(st) {
167 return nil 162 return nil
168 } 163 }
169 } 164 }
170 165
171 // Advance our query cursor. 166 // Advance our query cursor.
172 if resp.Next == "" { 167 if resp.Next == "" {
173 return nil 168 return nil
174 } 169 }
175 req.Next = resp.Next 170 req.Next = resp.Next
176 } 171 }
177 } 172 }
OLDNEW
« no previous file with comments | « logdog/client/coordinator/list.go ('k') | logdog/client/coordinator/stream.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698