func (m *multi) NewResponse() proto.Message {
	return &pb.MultiResponse{}
}
NewResponse creates an empty protobuf message to read the response of this RPC.
package region
import (
	"context"
	"errors"
	"fmt"
	"sync"
	"github.com/tsuna/gohbase/hrpc"
	"github.com/tsuna/gohbase/pb"
	"go.opentelemetry.io/otel/attribute"
	"go.opentelemetry.io/otel/trace"
	"google.golang.org/protobuf/proto"
)
var multiPool = sync.Pool{
	New: func() interface{} {
		return &multi{}
	},
}
func freeMulti(m *multi) {
	m.calls = m.calls[:0]
	m.regions = m.regions[:0]
	m.size = 0
	multiPool.Put(m)
}
type multi struct {
	ctx   context.Context
	size  int
	calls []hrpc.Call
	regions []hrpc.RegionInfo
}
func newMulti(ctx context.Context, queueSize int) *multi {
	m := multiPool.Get().(*multi)
	m.ctx = ctx
	m.size = queueSize
	return m
}
func (m *multi) Name() string {
	return "Multi"
}
func (m *multi) Description() string {
	return m.Name()
}
func (m *multi) ToProto() proto.Message {
	msg, _, _ := m.toProto(false)
	return msg
}
type actions struct {
	pbs        []*pb.Action
	cellblocks [][]byte
}
func (m *multi) toProto(isCellblocks bool) (proto.Message, [][]byte, uint32) {
	actionsPerReg := map[hrpc.RegionInfo]actions{}
	var size uint32
	for i, c := range m.calls {
		select {
		case <-c.Context().Done():
			m.calls[i] = nil
			continue
		default:
		}
		var msg proto.Message
		var cellblocks [][]byte
		if s, ok := c.(canSerializeCellBlocks); isCellblocks && ok && s.CellBlocksEnabled() {
			var sz uint32
			msg, cellblocks, sz = s.SerializeCellBlocks()
			size += sz
		} else {
			msg = c.ToProto()
		}
		a := &pb.Action{
			Index: proto.Uint32(uint32(i) + 1),  
		}
		switch r := msg.(type) {
		case *pb.GetRequest:
			a.Get = r.Get
		case *pb.MutateRequest:
			a.Mutation = r.Mutation
		default:
			panic(fmt.Sprintf("unsupported call type for Multi: %T", c))
		}
		as, ok := actionsPerReg[c.Region()]
		if !ok {
			as = actions{}
		}
		as.pbs = append(as.pbs, a)
		as.cellblocks = append(as.cellblocks, cellblocks...)
		actionsPerReg[c.Region()] = as
	}
	ra := make([]*pb.RegionAction, len(actionsPerReg))
	m.regions = make([]hrpc.RegionInfo, len(actionsPerReg))
	var cellblocks [][]byte
	i := 0
	for r, as := range actionsPerReg {
		ra[i] = &pb.RegionAction{
			Region: &pb.RegionSpecifier{
				Type:  pb.RegionSpecifier_REGION_NAME.Enum(),
				Value: r.Name(),
			},
			Action: as.pbs,
		}
		cellblocks = append(cellblocks, as.cellblocks...)
		m.regions[i] = r
		i++
	}
	return &pb.MultiRequest{RegionAction: ra}, cellblocks, size
}
func (m *multi) SerializeCellBlocks() (proto.Message, [][]byte, uint32) {
	return m.toProto(true)
}
func (m *multi) CellBlocksEnabled() bool {
	return true
}