OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package coordinator | 5 package coordinator |
6 | 6 |
7 import ( | 7 import ( |
8 "time" | 8 "time" |
9 | 9 |
10 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" | 10 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // QueryCallback is a callback method type that is used in query requests. | 126 // QueryCallback is a callback method type that is used in query requests. |
127 // | 127 // |
128 // If it returns false, additional callbacks and queries will be aborted. | 128 // If it returns false, additional callbacks and queries will be aborted. |
129 type QueryCallback func(r *LogStream) bool | 129 type QueryCallback func(r *LogStream) bool |
130 | 130 |
131 // Query executes a query, invoking the supplied callback once for each query | 131 // Query executes a query, invoking the supplied callback once for each query |
132 // result. | 132 // result. |
133 func (c *Client) Query(ctx context.Context, q *Query, cb QueryCallback) error { | 133 func (c *Client) Query(ctx context.Context, q *Query, cb QueryCallback) error { |
134 req := logdog.QueryRequest{ | 134 req := logdog.QueryRequest{ |
| 135 Project: string(c.project), |
135 Path: q.Path, | 136 Path: q.Path, |
136 ContentType: q.ContentType, | 137 ContentType: q.ContentType, |
137 Older: google.NewTimestamp(q.Before), | 138 Older: google.NewTimestamp(q.Before), |
138 Newer: google.NewTimestamp(q.After), | 139 Newer: google.NewTimestamp(q.After), |
139 Terminated: q.Terminated.queryValue(), | 140 Terminated: q.Terminated.queryValue(), |
140 Archived: q.Archived.queryValue(), | 141 Archived: q.Archived.queryValue(), |
141 Purged: q.Purged.queryValue(), | 142 Purged: q.Purged.queryValue(), |
142 State: q.State, | 143 State: q.State, |
143 } | 144 } |
144 if st := q.StreamType.queryValue(); st >= 0 { | 145 if st := q.StreamType.queryValue(); st >= 0 { |
(...skipping 22 matching lines...) Expand all Loading... |
167 } | 168 } |
168 } | 169 } |
169 | 170 |
170 // Advance our query cursor. | 171 // Advance our query cursor. |
171 if resp.Next == "" { | 172 if resp.Next == "" { |
172 return nil | 173 return nil |
173 } | 174 } |
174 req.Next = resp.Next | 175 req.Next = resp.Next |
175 } | 176 } |
176 } | 177 } |
OLD | NEW |