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: serde_protobuf.go
    path of file: ./repos/benthos/internal/impl/confluent
    
    the code of the file until where you have to start completion: package confluent

import (
	"context"
	"encoding/binary"
	"fmt"
	"sync"

	"google.golang.org/protobuf/encoding/protojson"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/reflect/protoreflect"
	"google.golang.org/protobuf/reflect/protoregistry"
	"google.golang.org/protobuf/types/dynamicpb"

	"github.com/benthosdev/benthos/v4/internal/impl/protobuf"
	"github.com/benthosdev/benthos/v4/public/service"
)

func (s *schemaRegistryDecoder) getProtobufDecoder(ctx context.Context, info SchemaInfo) (schemaDecoder, error) {
	regMap := map[string]string{
		".": info.Schema,
	}
	if err := s.client.WalkReferences(ctx, info.References, func(ctx context.Context, name string, si SchemaInfo) error {
		regMap[name] = si.Schema
		return nil
	}); err != nil {
		return nil, err
	}

	files, types, err := protobuf.RegistriesFromMap(regMap)
	if err != nil {
		return nil, fmt.Errorf("failed to parse proto schema: %v", err)
	}

	targetFile, err := files.FindFileByPath(".")
	if err
    
func (s *schemaRegistryEncoder) getProtobufEncoder(ctx context.Context, info SchemaInfo) (schemaEncoder, error) {
	regMap := map[string]string{
		".": info.Schema,
	}
	if err := s.client.WalkReferences(ctx, info.References, func(ctx context.Context, name string, si SchemaInfo) error {
		regMap[name] = si.Schema
		return nil
	}); err != nil {
		return nil, err
	}

	files, types, err := protobuf.RegistriesFromMap(regMap)
	if err != nil {
		return nil, fmt.Errorf("failed to parse proto schema: %v", err)
	}

	targetFile, err := files.FindFileByPath(".")
	if err != nil {
		return nil, err
	}
	msgTypesCache := newCachedMessageTypes(targetFile.Messages(), types)

	return func(m *service.Message) error {
		b, err := m.AsBytes()
		if err != nil {
			return err
		}

		dynMsg, indexBytes, err := msgTypesCache.TryParseMsg(b)
		if err != nil {
			return err
		}

		data, err := proto.Marshal(dynMsg)
		if err != nil {
			return fmt.Errorf("failed to marshal protobuf message: %w", err)
		}

		m.SetBytes(append(indexBytes, data...)) // TODO: Only allocate once by passing id through
		return nil
	}, nil
}