示例#1
0
func (h *blockHarness) eoi(pref string, iter iterator.Iterator) {
	if iter.Next() {
		h.t.Fatalf("block: %sNext: expect eoi", pref)
	} else if err := iter.Error(); err != nil {
		h.t.Fatalf("block: %sNext: expect eoi but got error, err=%v", pref, err)
	}
}
示例#2
0
// Builds table from src iterator.
func (t *tOps) createFrom(src iterator.Iterator) (f *tFile, n int, err error) {
	w, err := t.create()
	if err != nil {
		return f, n, err
	}

	defer func() {
		if err != nil {
			w.drop()
		}
	}()

	for src.Next() {
		err = w.append(src.Key(), src.Value())
		if err != nil {
			return
		}
	}
	err = src.Error()
	if err != nil {
		return
	}

	n = w.tw.EntriesLen()
	f, err = w.finish()
	return
}
示例#3
0
func (h *blockHarness) next(pref string, iter iterator.Iterator) {
	if !iter.Next() {
		h.t.Fatalf("block: %sNext: eoi, err=%v", pref, iter.Error())
	}
}