func (b *batch) Write() error {
	if b.ops == nil {
		return tmdb.ErrBatchClosed
	}
	_, err := b.db.dc.BatchWrite(b.db.ctx, &protodb.Batch{Ops: b.ops})
	if err != nil {
		return fmt.Errorf("remoteDB.BatchWrite: %w", err)
	}
	b.Close()
	return nil
}
Write implements Batch.
package remotedb
import (
	"fmt"
	tmdb "github.com/tendermint/tm-db"
	protodb "github.com/tendermint/tm-db/remotedb/proto"
)
type batch struct {
	db  *RemoteDB
	ops []*protodb.Operation
}
var _ tmdb.Batch = (*batch)(nil)
func newBatch(rdb *RemoteDB) *batch {
	return &batch{
		db:  rdb,
		ops: []*protodb.Operation{},
	}
}
func (b *batch) Set(key, value []byte) error {
	if b.ops == nil {
		return tmdb.ErrBatchClosed
	}
	op := &protodb.Operation{
		Entity: &protodb.Entity{Key: key, Value: value},
		Type:   protodb.Operation_SET,
	}
	b.ops = append(b.ops, op)
	return nil
}
func (b *batch) Delete(key []byte) error {
	if b.ops == nil {
		return tmdb.ErrBatchClosed
	}
	op := &protodb.Operation{
		Entity: &protodb.Entity{Key: key},
		Type:   protodb.Operation_DELETE,
	}
	b.ops = append(b.ops, op)
	return nil
}