Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 5a8688e

Browse files
committed
golint
1 parent ba64778 commit 5a8688e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mdata/cache/ccache_metric.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func (mc *CCacheMetric) Init(MKey schema.MKey, prev uint32, itergen chunk.IterGe
3737
mc.MKey = MKey
3838
}
3939

40+
// Del deletes chunks for the given timestamp
4041
func (mc *CCacheMetric) Del(ts uint32) int {
4142
mc.Lock()
4243
defer mc.Unlock()
@@ -121,7 +122,7 @@ func (mc *CCacheMetric) Add(prev uint32, itergen chunk.IterGen) {
121122
return
122123
}
123124

124-
// generate sorted slice of all chunk timestamps
125+
// generateKeys generates sorted slice of all chunk timestamps
125126
// assumes we have at least read lock
126127
func (mc *CCacheMetric) generateKeys() {
127128
keys := make([]uint32, 0, len(mc.chunks))
@@ -242,20 +243,21 @@ func (mc *CCacheMetric) searchBackward(from, until uint32, res *CCSearchResult)
242243
}
243244
}
244245

246+
// Search searches for the given metric
247+
//
245248
// the idea of this method is that we first look for the chunks where the
246249
// "from" and "until" ts are in. then we seek from the "from" towards "until"
247250
// and add as many cunks as possible to the result, if this did not result
248251
// in all chunks necessary to serve the request we do the same in the reverse
249252
// order from "until" to "from"
250253
// if the first seek in chronological direction already ends up with all the
251254
// chunks we need to serve the request, the second one can be skipped.
252-
255+
//
253256
// EXAMPLE:
254257
// from ts: |
255258
// until ts: |
256259
// cache: |---|---|---| | | | | |---|---|---|---|---|---|
257260
// chunks returned: |---| |---|---|---|
258-
//
259261
func (mc *CCacheMetric) Search(ctx context.Context, metric schema.AMKey, res *CCSearchResult, from, until uint32) {
260262
mc.RLock()
261263
defer mc.RUnlock()

0 commit comments

Comments
 (0)