本文整理汇总了Golang中github.com/conformal/goleveldb/leveldb/opt.ReadOptions类的典型用法代码示例。如果您正苦于以下问题:Golang ReadOptions类的具体用法?Golang ReadOptions怎么用?Golang ReadOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReadOptions类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: newIterator
func (db *DB) newIterator(seq uint64, ro *opt.ReadOptions) *dbIter {
rawIter := db.newRawIterator(ro)
iter := &dbIter{
cmp: db.s.cmp.cmp,
iter: rawIter,
seq: seq,
strict: db.s.o.GetStrict(opt.StrictIterator) || ro.GetStrict(opt.StrictIterator),
}
runtime.SetFinalizer(iter, (*dbIter).Release)
return iter
}
开发者ID:hsk81,项目名称:goleveldb,代码行数:11,代码来源:db_iter.go
示例2: newRawIterator
func (db *DB) newRawIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator {
em, fm := db.getMems()
v := db.s.version()
ti := v.getIterators(slice, ro)
n := len(ti) + 2
i := make([]iterator.Iterator, 0, n)
i = append(i, em.NewIterator(slice))
if fm != nil {
i = append(i, fm.NewIterator(slice))
}
i = append(i, ti...)
strict := db.s.o.GetStrict(opt.StrictIterator) || ro.GetStrict(opt.StrictIterator)
mi := iterator.NewMergedIterator(i, db.s.icmp, strict)
mi.SetReleaser(&versionReleaser{v: v})
return mi
}
开发者ID:stoiclabs,项目名称:blockchainr,代码行数:17,代码来源:db_iter.go
示例3: getIterators
func (v *version) getIterators(slice *util.Range, ro *opt.ReadOptions) (its []iterator.Iterator) {
// Merge all level zero files together since they may overlap
for _, t := range v.tables[0] {
it := v.s.tops.newIterator(t, slice, ro)
its = append(its, it)
}
strict := v.s.o.GetStrict(opt.StrictIterator) || ro.GetStrict(opt.StrictIterator)
for _, tables := range v.tables[1:] {
if len(tables) == 0 {
continue
}
it := iterator.NewIndexedIterator(tables.newIndexIterator(v.s.tops, v.s.icmp, slice, ro), strict, true)
its = append(its, it)
}
return
}
开发者ID:stoiclabs,项目名称:blockchainr,代码行数:19,代码来源:version.go
示例4: 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, tSeek)
}
if slice.Limit != nil {
islice.Limit = newIKey(slice.Limit, kMaxSeq, tSeek)
}
}
rawIter := db.newRawIterator(islice, 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
}
开发者ID:stoiclabs,项目名称:blockchainr,代码行数:23,代码来源:db_iter.go
示例5: Find
// Find finds key/value pair whose key is greater than or equal to the
// given key. It returns ErrNotFound if the table doesn't contain
// such pair.
//
// The caller should not modify the contents of the returned slice, but
// it is safe to modify the contents of the argument after Find returns.
func (r *Reader) Find(key []byte, ro *opt.ReadOptions) (rkey, value []byte, err error) {
if r.err != nil {
err = r.err
return
}
index := r.indexBlock.newIterator(nil)
defer index.Release()
if !index.Seek(key) {
err = index.Error()
if err == nil {
err = ErrNotFound
}
return
}
dataBH, n := decodeBlockHandle(index.Value())
if n == 0 {
err = errors.New("leveldb/table: Reader: invalid table (bad data block handle)")
return
}
if r.filterBlock != nil && !r.filterBlock.contains(dataBH.offset, key) {
err = ErrNotFound
return
}
data := r.getDataIter(dataBH, ro.GetStrict(opt.StrictBlockChecksum), !ro.GetDontFillCache())
defer data.Release()
if !data.Seek(key) {
err = data.Error()
if err == nil {
err = ErrNotFound
}
return
}
rkey = data.Key()
value = data.Value()
return
}
开发者ID:hsk81,项目名称:goleveldb,代码行数:43,代码来源:reader.go
示例6: NewIterator
// NewIterator returns an iterator of the table.
//
// The returned iterator is not goroutine-safe and should be released
// when not used.
//
// Also read Iterator documentation of the leveldb/iterator package.
func (r *Reader) NewIterator(ro *opt.ReadOptions) iterator.Iterator {
if r.err != nil {
return iterator.NewEmptyIterator(r.err)
}
index := &indexIter{
blockIter: *r.indexBlock.newIterator(nil),
tableReader: r,
checksum: ro.GetStrict(opt.StrictBlockChecksum),
fillCache: !ro.GetDontFillCache(),
}
return iterator.NewIndexedIterator(index, r.strictIter || ro.GetStrict(opt.StrictIterator), false)
}
开发者ID:hsk81,项目名称:goleveldb,代码行数:19,代码来源:reader.go
注:本文中的github.com/conformal/goleveldb/leveldb/opt.ReadOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论