func (b *cLevelDBBatch) Write() error {
	if b.batch == nil {
		return tmdb.ErrBatchClosed
	}
	err := b.db.db.Write(b.db.wo, b.batch)
	if err != nil {
		return err
	}
	return b.Close()
}
Write implements Batch.
package cleveldb
import (
	"github.com/jmhodges/levigo"
	tmdb "github.com/tendermint/tm-db"
)
type cLevelDBBatch struct {
	db    *CLevelDB
	batch *levigo.WriteBatch
}
func newCLevelDBBatch(db *CLevelDB) *cLevelDBBatch {
	return &cLevelDBBatch{
		db:    db,
		batch: levigo.NewWriteBatch(),
	}
}
func (b *cLevelDBBatch) Set(key, value []byte) error {
	if len(key) == 0 {
		return tmdb.ErrKeyEmpty
	}
	if value == nil {
		return tmdb.ErrValueNil
	}
	if b.batch == nil {
		return tmdb.ErrBatchClosed
	}
	b.batch.Put(key, value)
	return nil
}
func (b *cLevelDBBatch) Delete(key []byte) error {
	if len(key) == 0 {
		return tmdb.ErrKeyEmpty
	}
	if b.batch == nil {
		return tmdb.ErrBatchClosed
	}
	b.batch.Delete(key)
	return nil
}