db.go
func writeLevel0Table(ft flushTask, f io.Writer) error {
	iter := ft.mt.NewIterator()
	defer iter.Close()
	b := table.NewTableBuilder()
	defer b.Close()
	for iter.SeekToFirst(); iter.Valid(); iter.Next() {
		if len(ft.dropPrefix) > 0 && bytes.HasPrefix(iter.Key(), ft.dropPrefix) {
			continue
		}
		if err := b.Add(iter.Key(), iter.Value()); err != nil {
			return err
		}
	}
	_, err := f.Write(b.Finish())
	return err
}
func writeLevel0Table(ft flushTask, f io.Writer) error {
	iter := ft.mt.NewIterator()
	defer iter.Close()
	b := table.NewTableBuilder()
	defer b.Close()
	for iter.SeekToFirst(); iter.Valid(); iter.Next() {
		if len(ft.dropPrefix) > 0 && bytes.HasPrefix(iter.Key(), ft.dropPrefix) {
			continue
		}
		if err := b.Add(iter.Key(), iter.Value()); err != nil {
			return err
		}
	}
	_, err := f.Write(b.Finish())
	return err
}
func writeLevel0Table ( ft flushTask , f io . Writer ) error { iter := ft . mt . NewIterator ( ) defer iter . Close ( ) b := table . NewTableBuilder ( ) defer b . Close ( ) for iter . SeekToFirst ( ) ; iter . Valid ( ) ; iter . Next ( ) { if len ( ft . dropPrefix ) > 0 && bytes . HasPrefix ( iter . Key ( ) , ft . dropPrefix ) { continue } if err := b . Add ( iter . Key ( ) , iter . Value ( ) ) ; err != nil { return err } } _ , err := f . Write ( b . Finish ( ) ) return err }
// WriteLevel0Table flushes memtable.
WriteLevel0Table flushes memtable .