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 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" | 8 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" |
9 "github.com/luci/luci-go/common/logdog/types" | 9 "github.com/luci/luci-go/common/logdog/types" |
10 ) | 10 ) |
(...skipping 23 matching lines...) Expand all Loading... |
34 // zero. | 34 // zero. |
35 func (p *StreamGetParams) Index(i types.MessageIndex) *StreamGetParams { | 35 func (p *StreamGetParams) Index(i types.MessageIndex) *StreamGetParams { |
36 p = p.clone() | 36 p = p.clone() |
37 p.r.Index = int64(i) | 37 p.r.Index = int64(i) |
38 return p | 38 return p |
39 } | 39 } |
40 | 40 |
41 // Limit limits the returned logs either by count or by byte count. If either | 41 // Limit limits the returned logs either by count or by byte count. If either |
42 // limit is <= 0, then no limit will be applied and the server will choose how | 42 // limit is <= 0, then no limit will be applied and the server will choose how |
43 // many logs to return. | 43 // many logs to return. |
44 func (p *StreamGetParams) Limit(bytes, count int) *StreamGetParams { | 44 func (p *StreamGetParams) Limit(bytes, count int32) *StreamGetParams { |
45 p = p.clone() | 45 p = p.clone() |
46 | 46 |
47 if bytes < 0 { | 47 if bytes < 0 { |
48 bytes = 0 | 48 bytes = 0 |
49 } | 49 } |
50 if count < 0 { | 50 if count < 0 { |
51 count = 0 | 51 count = 0 |
52 } | 52 } |
53 | 53 |
54 » p.r.ByteCount, p.r.LogCount = int32(bytes), int32(count) | 54 » p.r.ByteCount, p.r.LogCount = bytes, count |
55 return p | 55 return p |
56 } | 56 } |
57 | 57 |
58 // NonContiguous returns a stream Get parameter that causes the Get request | 58 // NonContiguous returns a stream Get parameter that causes the Get request |
59 // to allow non-contiguous records to be returned. By default, only contiguous | 59 // to allow non-contiguous records to be returned. By default, only contiguous |
60 // records starting from the specific Index will be returned. | 60 // records starting from the specific Index will be returned. |
61 // | 61 // |
62 // By default, a log stream will return only contiguous records starting at the | 62 // By default, a log stream will return only contiguous records starting at the |
63 // requested index. For example, if a stream had: {0, 1, 2, 4, 5} and a request | 63 // requested index. For example, if a stream had: {0, 1, 2, 4, 5} and a request |
64 // was made for index 0, Get will return {0, 1, 2}, for index 3 {}, and for | 64 // was made for index 0, Get will return {0, 1, 2}, for index 3 {}, and for |
(...skipping 11 matching lines...) Expand all Loading... |
76 return p | 76 return p |
77 } | 77 } |
78 | 78 |
79 // State returns a stream Get parameter that causes the Get request to return | 79 // State returns a stream Get parameter that causes the Get request to return |
80 // its stream state and log stream descriptor. | 80 // its stream state and log stream descriptor. |
81 func (p *StreamGetParams) State(stateP *LogStream) *StreamGetParams { | 81 func (p *StreamGetParams) State(stateP *LogStream) *StreamGetParams { |
82 p = p.clone() | 82 p = p.clone() |
83 p.stateP = stateP | 83 p.stateP = stateP |
84 return p | 84 return p |
85 } | 85 } |
OLD | NEW |