2 Star 0 Fork 0

djienet/kratos

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
iterator.go 582 Bytes
Copy Edit Raw Blame History
chenli authored 2020-11-02 15:31 +08:00 . init
package metric
import "fmt"
// Iterator iterates the buckets within the window.
type Iterator struct {
count int
iteratedCount int
cur *Bucket
}
// Next returns true util all of the buckets has been iterated.
func (i *Iterator) Next() bool {
return i.count != i.iteratedCount
}
// Bucket gets current bucket.
func (i *Iterator) Bucket() Bucket {
if !(i.Next()) {
panic(fmt.Errorf("stat/metric: iteration out of range iteratedCount: %d count: %d", i.iteratedCount, i.count))
}
bucket := *i.cur
i.iteratedCount++
i.cur = i.cur.Next()
return bucket
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/djienet/kratos.git
git@gitee.com:djienet/kratos.git
djienet
kratos
kratos
v1.1.7

Search