Ejemplo n.º 1
0
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)
	}
	err := db.CompactRange(r)
	if err != nil {
		t.Error("CompactRange: got error: ", err)
	}
}
Ejemplo n.º 2
0
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{
		cmp:    db.s.cmp.cmp,
		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
}