本文整理汇总了Golang中github.com/syndtr/goleveldb/leveldb/util.Range类的典型用法代码示例。如果您正苦于以下问题:Golang Range类的具体用法?Golang Range怎么用?Golang Range使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Range类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newIterator
func (db *DB) newIterator(seq uint64, slice *util.Range, ro *opt.ReadOptions) *dbIter {
var islice *util.Range
if slice != nil {
islice = &util.Range{}
if slice.Start != nil {
islice.Start = newIkey(slice.Start, kMaxSeq, ktSeek)
}
if slice.Limit != nil {
islice.Limit = newIkey(slice.Limit, kMaxSeq, ktSeek)
}
}
rawIter := db.newRawIterator(islice, ro)
iter := &dbIter{
db: db,
icmp: db.s.icmp,
iter: rawIter,
seq: seq,
strict: opt.GetStrict(db.s.o.Options, ro, opt.StrictReader),
key: make([]byte, 0),
value: make([]byte, 0),
}
atomic.AddInt32(&db.aliveIters, 1)
runtime.SetFinalizer(iter, (*dbIter).Release)
return iter
}
示例2: List
// List streams all known blobs of a particular type.
func (d *DB) List(ct string) <-chan string {
var rng util.Range
if ct != "" {
rng.Start = pack(camliType, ct, start)
rng.Limit = pack(camliType, ct, limit)
} else {
rng.Start = pack(camliType, start)
rng.Limit = pack(camliType, limit)
}
ch := make(chan string)
go d.streamBlobs(ch, 2, &rng)
return ch
}
示例3: compactRange
func (h *dbHarness) compactRange(min, max string) {
t := h.t
db := h.db
var r util.Range
if min != "" {
r.Start = []byte(min)
}
if max != "" {
r.Limit = []byte(max)
}
if err := db.CompactRange(r); err != nil {
t.Error("CompactRange: got error: ", err)
}
}
示例4: newIterator
func (db *DB) newIterator(seq uint64, slice *util.Range, ro *opt.ReadOptions) *dbIter {
var slice_ *util.Range
if slice != nil {
slice_ = &util.Range{}
if slice.Start != nil {
slice_.Start = newIKey(slice.Start, kMaxSeq, tSeek)
}
if slice.Limit != nil {
slice_.Limit = newIKey(slice.Limit, kMaxSeq, tSeek)
}
}
rawIter := db.newRawIterator(slice_, ro)
iter := &dbIter{
icmp: db.s.icmp,
iter: rawIter,
seq: seq,
strict: db.s.o.GetStrict(opt.StrictIterator) || ro.GetStrict(opt.StrictIterator),
key: make([]byte, 0),
value: make([]byte, 0),
}
runtime.SetFinalizer(iter, (*dbIter).Release)
return iter
}