| OLD | NEW |
| 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 "fmt" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| 11 "github.com/luci/luci-go/common/config" | |
| 12 "github.com/luci/luci-go/common/proto/google" | 11 "github.com/luci/luci-go/common/proto/google" |
| 13 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" | 12 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" |
| 14 "github.com/luci/luci-go/logdog/api/logpb" | 13 "github.com/luci/luci-go/logdog/api/logpb" |
| 15 "github.com/luci/luci-go/logdog/common/types" | 14 "github.com/luci/luci-go/logdog/common/types" |
| 15 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 16 "golang.org/x/net/context" | 16 "golang.org/x/net/context" |
| 17 ) | 17 ) |
| 18 | 18 |
| 19 // QueryTrinary is a 3-value query option type. | 19 // QueryTrinary is a 3-value query option type. |
| 20 type QueryTrinary int | 20 type QueryTrinary int |
| 21 | 21 |
| 22 const ( | 22 const ( |
| 23 // Both means that the value should not have an effect. | 23 // Both means that the value should not have an effect. |
| 24 Both QueryTrinary = iota | 24 Both QueryTrinary = iota |
| 25 // Yes is a positive effect. | 25 // Yes is a positive effect. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // - Empty ("") will return all streams. | 119 // - Empty ("") will return all streams. |
| 120 // - **/+/** will return all streams. | 120 // - **/+/** will return all streams. |
| 121 // - foo/bar/** will return all streams with the "foo/bar" prefix. | 121 // - foo/bar/** will return all streams with the "foo/bar" prefix. |
| 122 // - foo/bar/**/+/baz will return all streams beginning with the "foo/bar" | 122 // - foo/bar/**/+/baz will return all streams beginning with the "foo/bar" |
| 123 // prefix and named "baz" (e.g., "foo/bar/qux/lol/+/baz") | 123 // prefix and named "baz" (e.g., "foo/bar/qux/lol/+/baz") |
| 124 // - foo/bar/+/** will return all streams with a "foo/bar" prefix. | 124 // - foo/bar/+/** will return all streams with a "foo/bar" prefix. |
| 125 // - foo/*/+/baz will return all streams with a two-component prefix whose | 125 // - foo/*/+/baz will return all streams with a two-component prefix whose |
| 126 // first value is "foo" and whose name is "baz". | 126 // first value is "foo" and whose name is "baz". |
| 127 // - foo/bar will return all streams whose name is "foo/bar". | 127 // - foo/bar will return all streams whose name is "foo/bar". |
| 128 // - */* will return all streams with two-component names. | 128 // - */* will return all streams with two-component names. |
| 129 func (c *Client) Query(ctx context.Context, project config.ProjectName, path str
ing, o QueryOptions, cb QueryCallback) error { | 129 func (c *Client) Query(ctx context.Context, project cfgtypes.ProjectName, path s
tring, o QueryOptions, cb QueryCallback) error { |
| 130 req := logdog.QueryRequest{ | 130 req := logdog.QueryRequest{ |
| 131 Project: string(project), | 131 Project: string(project), |
| 132 Path: path, | 132 Path: path, |
| 133 ContentType: o.ContentType, | 133 ContentType: o.ContentType, |
| 134 Older: google.NewTimestamp(o.Before), | 134 Older: google.NewTimestamp(o.Before), |
| 135 Newer: google.NewTimestamp(o.After), | 135 Newer: google.NewTimestamp(o.After), |
| 136 Purged: o.Purged.queryValue(), | 136 Purged: o.Purged.queryValue(), |
| 137 State: o.State, | 137 State: o.State, |
| 138 } | 138 } |
| 139 if st := o.StreamType.queryValue(); st >= 0 { | 139 if st := o.StreamType.queryValue(); st >= 0 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Advance our query cursor. | 170 // Advance our query cursor. |
| 171 if resp.Next == "" { | 171 if resp.Next == "" { |
| 172 return nil | 172 return nil |
| 173 } | 173 } |
| 174 req.Next = resp.Next | 174 req.Next = resp.Next |
| 175 } | 175 } |
| 176 } | 176 } |
| OLD | NEW |