You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: batch.go
    path of file: ./repos/cosmos-sdk/store/storage/pebbledb
    
    the code of the file until where you have to start completion: package pebbledb

import (
	"encoding/binary"
	"errors"
	"fmt"

	"github.com/cockroachdb/pebble"

	"cosmossdk.io/store/v2"
)

var _ store.Batch = (*Batch)(nil)

type Batch struct {
	storage *pebble.DB
	batch   *pebble.Batch
	version uint64
	sync    bool
}

func NewBatch(storage *pebble.DB, version uint64, sync bool) (*Batch, er
    
func (b *Batch) set(storeKey string, tombstone uint64, key, value []byte) error {
	prefixedKey := MVCCEncode(prependStoreKey(storeKey, key), b.version)
	prefixedVal := MVCCEncode(value, tombstone)

	if err := b.batch.Set(prefixedKey, prefixedVal, nil); err != nil {
		return fmt.Errorf("failed to write PebbleDB batch: %w", err)
	}

	return nil
}