| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 syntax = "proto3"; | 5 syntax = "proto3"; |
| 6 | 6 |
| 7 package logdog; | 7 package logdog; |
| 8 | 8 |
| 9 import "state.proto"; | 9 import "state.proto"; |
| 10 import "github.com/luci/luci-go/common/proto/logdog/logpb/log.proto"; | 10 import "github.com/luci/luci-go/common/proto/logdog/logpb/log.proto"; |
| 11 import "google/protobuf/timestamp.proto"; | 11 import "google/protobuf/timestamp.proto"; |
| 12 | 12 |
| 13 // GetRequest is the request structure for the user Get endpoint. | 13 // GetRequest is the request structure for the user Get endpoint. |
| 14 // | 14 // |
| 15 // If the requested log stream exists, a valid GetRequest will succeed | 15 // If the requested log stream exists, a valid GetRequest will succeed |
| 16 // regardless of whether the requested log range was available. | 16 // regardless of whether the requested log range was available. |
| 17 // | 17 // |
| 18 // Note that this endpoint may return fewer logs than requested due to either | 18 // Note that this endpoint may return fewer logs than requested due to either |
| 19 // availability or internal constraints. | 19 // availability or internal constraints. |
| 20 message GetRequest { | 20 message GetRequest { |
| 21 // The request project to request. |
| 22 string project = 1; |
| 21 // The path of the log stream to get. | 23 // The path of the log stream to get. |
| 22 // | 24 // |
| 23 // This can either be a LogDog stream path or the SHA256 hash of a LogDog | 25 // This can either be a LogDog stream path or the SHA256 hash of a LogDog |
| 24 // stream path. | 26 // stream path. |
| 25 // | 27 // |
| 26 // Some utilities may find passing around a full LogDog path to be cumbersome | 28 // Some utilities may find passing around a full LogDog path to be cumbersome |
| 27 // due to its length. They can opt to pass around the hash instead and | 29 // due to its length. They can opt to pass around the hash instead and |
| 28 // retrieve logs using it. | 30 // retrieve logs using it. |
| 29 string path = 1; | 31 string path = 2; |
| 30 | 32 |
| 31 // If true, requests that the log stream's state is returned. | 33 // If true, requests that the log stream's state is returned. |
| 32 bool state = 2; | 34 bool state = 3; |
| 33 | 35 |
| 34 // The initial log stream index to retrieve. | 36 // The initial log stream index to retrieve. |
| 35 int64 index = 10; | 37 int64 index = 4; |
| 36 | 38 |
| 37 // The maximum number of bytes to return. If non-zero, it is applied as a | 39 // The maximum number of bytes to return. If non-zero, it is applied as a |
| 38 // constraint to limit the number of logs that are returned. | 40 // constraint to limit the number of logs that are returned. |
| 39 // | 41 // |
| 40 // This only returns complete logs. Assuming logs are available, it will | 42 // This only returns complete logs. Assuming logs are available, it will |
| 41 // return at least one log (even if it violates the size constraint) and as | 43 // return at least one log (even if it violates the size constraint) and as |
| 42 // many additional logs as it can without exceeding this constraint. | 44 // many additional logs as it can without exceeding this constraint. |
| 43 int32 byte_count = 11; | 45 int32 byte_count = 5; |
| 44 | 46 |
| 45 // The maximum number of log records to request. | 47 // The maximum number of log records to request. |
| 46 // | 48 // |
| 47 // If this value is zero, no count constraint will be applied. If this value | 49 // If this value is zero, no count constraint will be applied. If this value |
| 48 // is less than zero, no log entries will be returned. This can be used to | 50 // is less than zero, no log entries will be returned. This can be used to |
| 49 // fetch log stream descriptors without fetching any log records. | 51 // fetch log stream descriptors without fetching any log records. |
| 50 int32 log_count = 12; | 52 int32 log_count = 6; |
| 51 | 53 |
| 52 // If true, allows the range request to return non-contiguous records. | 54 // If true, allows the range request to return non-contiguous records. |
| 53 // | 55 // |
| 54 // A contiguous request (default) will iterate forwards from the supplied | 56 // A contiguous request (default) will iterate forwards from the supplied |
| 55 // Index and stop if either the end of stream is encountered or there is a | 57 // Index and stop if either the end of stream is encountered or there is a |
| 56 // missing stream index. A NonContiguous request will remove the latter | 58 // missing stream index. A NonContiguous request will remove the latter |
| 57 // condition. | 59 // condition. |
| 58 // | 60 // |
| 59 // For example, say the log stream consists of: | 61 // For example, say the log stream consists of: |
| 60 // [3, 4, 6, 7] | 62 // [3, 4, 6, 7] |
| 61 // | 63 // |
| 62 // A contiguous request with Index 3 will return: [3, 4], stopping because | 64 // A contiguous request with Index 3 will return: [3, 4], stopping because |
| 63 // 5 is missing. A non-contiguous request will return [3, 4, 6, 7]. | 65 // 5 is missing. A non-contiguous request will return [3, 4, 6, 7]. |
| 64 bool non_contiguous = 13; | 66 bool non_contiguous = 7; |
| 65 } | 67 } |
| 66 | 68 |
| 67 // TailRequest is the request structure for the user Tail endpoint. It returns | 69 // TailRequest is the request structure for the user Tail endpoint. It returns |
| 68 // the last log in a given log stream at the time of the request. | 70 // the last log in a given log stream at the time of the request. |
| 69 message TailRequest { | 71 message TailRequest { |
| 72 // The request project to request. |
| 73 string project = 1; |
| 70 // The path of the log stream to get. | 74 // The path of the log stream to get. |
| 71 // | 75 // |
| 72 // This can either be a LogDog stream path or the SHA256 hash of a LogDog | 76 // This can either be a LogDog stream path or the SHA256 hash of a LogDog |
| 73 // stream path. | 77 // stream path. |
| 74 // | 78 // |
| 75 // Some utilities may find passing around a full LogDog path to be cumbersome | 79 // Some utilities may find passing around a full LogDog path to be cumbersome |
| 76 // due to its length. They can opt to pass around the hash instead and | 80 // due to its length. They can opt to pass around the hash instead and |
| 77 // retrieve logs using it. | 81 // retrieve logs using it. |
| 78 string path = 1; | 82 string path = 2; |
| 79 | 83 |
| 80 // If true, requests that the log stream's state is returned. | 84 // If true, requests that the log stream's state is returned. |
| 81 bool state = 2; | 85 bool state = 3; |
| 82 } | 86 } |
| 83 | 87 |
| 84 // GetResponse is the response structure for the user Get endpoint. | 88 // GetResponse is the response structure for the user Get endpoint. |
| 85 message GetResponse { | 89 message GetResponse { |
| 86 // The log stream descriptor and state for this stream. | 90 // The log stream descriptor and state for this stream. |
| 87 // | 91 // |
| 88 // It can be requested by setting the request's State field to true. If the | 92 // It can be requested by setting the request's State field to true. If the |
| 89 // Proto field is true, the State's Descriptor field will not be included. | 93 // Proto field is true, the State's Descriptor field will not be included. |
| 90 LogStreamState state = 1; | 94 LogStreamState state = 1; |
| 91 | 95 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 106 // Trinary represents a trinary value. | 110 // Trinary represents a trinary value. |
| 107 enum Trinary { | 111 enum Trinary { |
| 108 // Both positive and negative results will be returned. | 112 // Both positive and negative results will be returned. |
| 109 BOTH = 0; | 113 BOTH = 0; |
| 110 // Only positive results will be returned. | 114 // Only positive results will be returned. |
| 111 YES = 1; | 115 YES = 1; |
| 112 // Only negative results will be returned. | 116 // Only negative results will be returned. |
| 113 NO = 2; | 117 NO = 2; |
| 114 } | 118 } |
| 115 | 119 |
| 120 // The request project to request. |
| 121 string project = 1; |
| 116 // The query parameter. | 122 // The query parameter. |
| 117 // | 123 // |
| 118 // The path expression may substitute a glob ("*") for a specific path | 124 // The path expression may substitute a glob ("*") for a specific path |
| 119 // component. That is, any stream that matches the remaining structure qualifi
es | 125 // component. That is, any stream that matches the remaining structure qualifi
es |
| 120 // regardless of its value in that specific positional field. | 126 // regardless of its value in that specific positional field. |
| 121 // | 127 // |
| 122 // An unbounded wildcard may appear as a component at the end of both the | 128 // An unbounded wildcard may appear as a component at the end of both the |
| 123 // prefix and name query components. "**" matches all remaining components. | 129 // prefix and name query components. "**" matches all remaining components. |
| 124 // | 130 // |
| 125 // If the supplied path query does not contain a path separator ("+"), it will | 131 // If the supplied path query does not contain a path separator ("+"), it will |
| 126 // be treated as if the prefix is "**". | 132 // be treated as if the prefix is "**". |
| 127 // | 133 // |
| 128 // Examples: | 134 // Examples: |
| 129 // - Empty ("") will return all streams. | 135 // - Empty ("") will return all streams. |
| 130 // - **/+/** will return all streams. | 136 // - **/+/** will return all streams. |
| 131 // - foo/bar/** will return all streams with the "foo/bar" prefix. | 137 // - foo/bar/** will return all streams with the "foo/bar" prefix. |
| 132 // - foo/bar/**/+/baz will return all streams beginning with the "foo/bar" | 138 // - foo/bar/**/+/baz will return all streams beginning with the "foo/bar" |
| 133 // prefix and named "baz" (e.g., "foo/bar/qux/lol/+/baz") | 139 // prefix and named "baz" (e.g., "foo/bar/qux/lol/+/baz") |
| 134 // - foo/bar/+/** will return all streams with a "foo/bar" prefix. | 140 // - foo/bar/+/** will return all streams with a "foo/bar" prefix. |
| 135 // - foo/*/+/baz will return all streams with a two-component prefix whose | 141 // - foo/*/+/baz will return all streams with a two-component prefix whose |
| 136 // first value is "foo" and whose name is "baz". | 142 // first value is "foo" and whose name is "baz". |
| 137 // - foo/bar will return all streams whose name is "foo/bar". | 143 // - foo/bar will return all streams whose name is "foo/bar". |
| 138 // - */* will return all streams with two-component names. | 144 // - */* will return all streams with two-component names. |
| 139 string path = 1; | 145 string path = 2; |
| 140 | 146 |
| 141 // ContentType, if not empty, restricts results to streams with the supplied | 147 // ContentType, if not empty, restricts results to streams with the supplied |
| 142 // content type. | 148 // content type. |
| 143 string content_type = 2; | 149 string content_type = 3; |
| 144 | 150 |
| 145 // The stream type to filter on. | 151 // The stream type to filter on. |
| 146 message StreamTypeFilter { | 152 message StreamTypeFilter { |
| 147 // The StreamType value to filter on. | 153 // The StreamType value to filter on. |
| 148 logpb.StreamType value = 1; | 154 logpb.StreamType value = 1; |
| 149 } | 155 } |
| 150 StreamTypeFilter stream_type = 3; | 156 StreamTypeFilter stream_type = 4; |
| 151 | 157 |
| 152 // Terminated, if not nil, restricts the query to streams that have or haven't | 158 // Terminated, if not nil, restricts the query to streams that have or haven't |
| 153 // been terminated. | 159 // been terminated. |
| 154 Trinary terminated = 4; | 160 Trinary terminated = 5; |
| 155 | 161 |
| 156 // Archived, if not nil, restricts the query to streams that have or haven't | 162 // Archived, if not nil, restricts the query to streams that have or haven't |
| 157 // been archived. | 163 // been archived. |
| 158 Trinary archived = 5; | 164 Trinary archived = 6; |
| 159 | 165 |
| 160 // Purged, if not nil, restricts the query to streams that have or haven't | 166 // Purged, if not nil, restricts the query to streams that have or haven't |
| 161 // been purged. | 167 // been purged. |
| 162 Trinary purged = 6; | 168 Trinary purged = 7; |
| 163 | 169 |
| 164 // Newer restricts results to streams created after the specified date. | 170 // Newer restricts results to streams created after the specified date. |
| 165 google.protobuf.Timestamp newer = 7; | 171 google.protobuf.Timestamp newer = 8; |
| 166 // Older restricts results to streams created before the specified date. | 172 // Older restricts results to streams created before the specified date. |
| 167 google.protobuf.Timestamp older = 8; | 173 google.protobuf.Timestamp older = 9; |
| 168 | 174 |
| 169 // If not empty, constrains the results to those whose protobuf version string | 175 // If not empty, constrains the results to those whose protobuf version string |
| 170 // matches the supplied version. | 176 // matches the supplied version. |
| 171 string proto_version = 9; | 177 string proto_version = 10; |
| 172 | 178 |
| 173 // Tags is the set of tags to constrain the query with. | 179 // Tags is the set of tags to constrain the query with. |
| 174 // | 180 // |
| 175 // A Tag entry may either be: | 181 // A Tag entry may either be: |
| 176 // - A key/value query, in which case the results are constrained by logs | 182 // - A key/value query, in which case the results are constrained by logs |
| 177 // whose tag includes that key/value pair. | 183 // whose tag includes that key/value pair. |
| 178 // - A key with an missing (nil) value, in which case the results are | 184 // - A key with an missing (nil) value, in which case the results are |
| 179 // constraints by logs that have that tag key, regardless of its value. | 185 // constraints by logs that have that tag key, regardless of its value. |
| 180 map<string, string> tags = 10; | 186 map<string, string> tags = 11; |
| 181 | 187 |
| 182 // Next, if not empty, indicates that this query should continue at the point | 188 // Next, if not empty, indicates that this query should continue at the point |
| 183 // where the previous query left off. | 189 // where the previous query left off. |
| 184 string next = 11; | 190 string next = 12; |
| 185 | 191 |
| 186 // MaxResults is the maximum number of query results to return. | 192 // MaxResults is the maximum number of query results to return. |
| 187 // | 193 // |
| 188 // If MaxResults is zero, no upper bound will be indicated. However, the | 194 // If MaxResults is zero, no upper bound will be indicated. However, the |
| 189 // returned result count is still be subject to internal constraints. | 195 // returned result count is still be subject to internal constraints. |
| 190 int32 max_results = 12; | 196 int32 max_results = 13; |
| 191 | 197 |
| 192 // If true, returns that the streams' full state is returned instead of just | 198 // If true, returns that the streams' full state is returned instead of just |
| 193 // its Path. | 199 // its Path. |
| 194 bool state = 13; | 200 bool state = 14; |
| 195 | 201 |
| 196 // If true, causes the requested state to be returned as serialized protobuf | 202 // If true, causes the requested state to be returned as serialized protobuf |
| 197 // data instead of deserialized JSON structures. | 203 // data instead of deserialized JSON structures. |
| 198 bool proto = 14; | 204 bool proto = 15; |
| 199 } | 205 } |
| 200 | 206 |
| 201 // QueryResponse is the response structure for the user Query endpoint. | 207 // QueryResponse is the response structure for the user Query endpoint. |
| 202 message QueryResponse { | 208 message QueryResponse { |
| 203 | 209 |
| 204 // Stream represents a single query response stream. | 210 // Stream represents a single query response stream. |
| 205 message Stream { | 211 message Stream { |
| 206 // Path is the log stream path. | 212 // Path is the log stream path. |
| 207 string path = 1; | 213 string path = 1; |
| 208 | 214 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 229 repeated Stream streams = 1; | 235 repeated Stream streams = 1; |
| 230 | 236 |
| 231 // If not empty, indicates that there are more query results available. | 237 // If not empty, indicates that there are more query results available. |
| 232 // These results can be requested by repeating the Query request with the | 238 // These results can be requested by repeating the Query request with the |
| 233 // same Path field and supplying this value in the Next field. | 239 // same Path field and supplying this value in the Next field. |
| 234 string next = 2; | 240 string next = 2; |
| 235 } | 241 } |
| 236 | 242 |
| 237 // ListRequest is the request structure for the user List endpoint. | 243 // ListRequest is the request structure for the user List endpoint. |
| 238 message ListRequest { | 244 message ListRequest { |
| 245 // The request project to request. |
| 246 string project = 1; |
| 239 // Path is the query parameter. | 247 // Path is the query parameter. |
| 240 // | 248 // |
| 241 // Path should be a prefix fragment of a the valid stream path hierarchy | 249 // Path should be a prefix fragment of a the valid stream path hierarchy |
| 242 // root to query. | 250 // root to query. |
| 243 string path = 1; | 251 string path = 2; |
| 244 | 252 |
| 245 // If true, returns streams under the specified root recursively. Otherwise, | 253 // If true, returns streams under the specified root recursively. Otherwise, |
| 246 // only path components immediately under the specified root will be returned. | 254 // only path components immediately under the specified root will be returned. |
| 247 bool recursive = 2; | 255 bool recursive = 3; |
| 248 // If true, will return only streams. Otherwise, intermediate path components | 256 // If true, will return only streams. Otherwise, intermediate path components |
| 249 // will also be returned. | 257 // will also be returned. |
| 250 bool stream_only = 3; | 258 bool stream_only = 4; |
| 251 // If true, indicates that purged streams should show up in the listing. It is | 259 // If true, indicates that purged streams should show up in the listing. It is |
| 252 // an error if a non-admin user requests this option. | 260 // an error if a non-admin user requests this option. |
| 253 bool include_purged = 4; | 261 bool include_purged = 5; |
| 254 | 262 |
| 255 // The maximum number of componts to return. | 263 // The maximum number of componts to return. |
| 256 // | 264 // |
| 257 // If <= 0, no upper bound will be indicated. However, the returned result | 265 // If <= 0, no upper bound will be indicated. However, the returned result |
| 258 // count is still be subject to internal constraints. | 266 // count is still be subject to internal constraints. |
| 259 int32 max_results = 5; | 267 int32 max_results = 6; |
| 260 // If not empty, indicates that this query should continue at the point where | 268 // If not empty, indicates that this query should continue at the point where |
| 261 // the previous query left off. | 269 // the previous query left off. |
| 262 string next = 6; | 270 string next = 7; |
| 263 | 271 |
| 264 // State, if true, returns that the streams' full state instead of just its | 272 // State, if true, returns that the streams' full state instead of just its |
| 265 // Path. | 273 // Path. |
| 266 bool state = 7; | 274 bool state = 8; |
| 267 | 275 |
| 268 // Offset, if >= 0, instructs the list operation to skip the supplied number | 276 // Offset, if >= 0, instructs the list operation to skip the supplied number |
| 269 // of results. This can be used for pagination. | 277 // of results. This can be used for pagination. |
| 270 int32 offset = 8; | 278 int32 offset = 9; |
| 271 } | 279 } |
| 272 | 280 |
| 273 // ListResponse is the response structure for the user List endpoint. | 281 // ListResponse is the response structure for the user List endpoint. |
| 274 message ListResponse { | 282 message ListResponse { |
| 283 // The request project to request. |
| 284 string project = 1; |
| 275 // Base is the hierarchy base that was requested. | 285 // Base is the hierarchy base that was requested. |
| 276 string base = 1; | 286 string base = 2; |
| 277 | 287 |
| 278 // If not empty, indicates that there are more list results available. | 288 // If not empty, indicates that there are more list results available. |
| 279 // These results can be requested by repeating the List request with the | 289 // These results can be requested by repeating the List request with the |
| 280 // same Path field and supplying this value in the Next field. | 290 // same Path field and supplying this value in the Next field. |
| 281 string next = 2; | 291 string next = 3; |
| 282 | 292 |
| 283 // The set of listed stream components. | 293 // The set of listed stream components. |
| 284 message Component { | 294 message Component { |
| 285 // Path is the path component for this entry. When combined with the respons
e | 295 // Path is the path component for this entry. When combined with the respons
e |
| 286 // Base, this will form the full stream path. | 296 // Base, this will form the full stream path. |
| 287 string path = 1; | 297 string path = 1; |
| 288 // Stream is true if this is a stream component (as opposed to a path | 298 // Stream is true if this is a stream component (as opposed to a path |
| 289 // component). | 299 // component). |
| 290 bool stream = 2; | 300 bool stream = 2; |
| 291 | 301 |
| 292 // State is the log stream descriptor and state for this stream. It will onl
y | 302 // State is the log stream descriptor and state for this stream. It will onl
y |
| 293 // be filled if this is a stream component. | 303 // be filled if this is a stream component. |
| 294 // | 304 // |
| 295 // It can be requested by setting the request's State field to true. If the | 305 // It can be requested by setting the request's State field to true. If the |
| 296 // Proto field is true, the State's Descriptor field will not be included. | 306 // Proto field is true, the State's Descriptor field will not be included. |
| 297 LogStreamState state = 3; | 307 LogStreamState state = 3; |
| 298 | 308 |
| 299 // Descriptor is the JSON-packed log stream descriptor protobuf. It will onl
y | 309 // Descriptor is the JSON-packed log stream descriptor protobuf. It will onl
y |
| 300 // be filled if this is a stream component. | 310 // be filled if this is a stream component. |
| 301 // | 311 // |
| 302 // A Descriptor entry corresponds to the Path with the same index. | 312 // A Descriptor entry corresponds to the Path with the same index. |
| 303 // | 313 // |
| 304 // If the list request's State field is set, the descriptor will be | 314 // If the list request's State field is set, the descriptor will be |
| 305 // populated. | 315 // populated. |
| 306 logpb.LogStreamDescriptor desc = 4; | 316 logpb.LogStreamDescriptor desc = 4; |
| 307 } | 317 } |
| 308 repeated Component components = 3; | 318 repeated Component components = 4; |
| 309 } | 319 } |
| 310 | 320 |
| 311 // Logs is the user-facing log access and query endpoint service. | 321 // Logs is the user-facing log access and query endpoint service. |
| 312 service Logs { | 322 service Logs { |
| 313 // Get returns state and log data for a single log stream. | 323 // Get returns state and log data for a single log stream. |
| 314 rpc Get(GetRequest) returns (GetResponse); | 324 rpc Get(GetRequest) returns (GetResponse); |
| 315 | 325 |
| 316 // Tail returns the last log in the log stream at the time of the request. | 326 // Tail returns the last log in the log stream at the time of the request. |
| 317 rpc Tail(TailRequest) returns (GetResponse); | 327 rpc Tail(TailRequest) returns (GetResponse); |
| 318 | 328 |
| 319 // Query returns log stream paths that match the requested query. | 329 // Query returns log stream paths that match the requested query. |
| 320 rpc Query(QueryRequest) returns (QueryResponse); | 330 rpc Query(QueryRequest) returns (QueryResponse); |
| 321 | 331 |
| 322 // List returns log stream paths rooted under the path hierarchy. | 332 // List returns log stream paths rooted under the path hierarchy. |
| 323 rpc List(ListRequest) returns (ListResponse); | 333 rpc List(ListRequest) returns (ListResponse); |
| 324 } | 334 } |
| OLD | NEW |