codec

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Codec_GetEncoding_FullMethodName = "/codec.Codec/GetEncoding"
	Codec_GetDecoding_FullMethodName = "/codec.Codec/GetDecoding"
	Codec_GetMaxSize_FullMethodName  = "/codec.Codec/GetMaxSize"
)
View Source
const DefaultEncodingVersion = CBOREncodingVersion

Variables

View Source
var Codec_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "codec.Codec",
	HandlerType: (*CodecServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetEncoding",
			Handler:    _Codec_GetEncoding_Handler,
		},
		{
			MethodName: "GetDecoding",
			Handler:    _Codec_GetDecoding_Handler,
		},
		{
			MethodName: "GetMaxSize",
			Handler:    _Codec_GetMaxSize_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "internal/codec/codec.proto",
}

Codec_ServiceDesc is the grpc.ServiceDesc for Codec service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_internal_codec_codec_proto protoreflect.FileDescriptor

Functions

func DecodeVersionedBytes

func DecodeVersionedBytes(res any, vData *VersionedBytes) error

func RegisterCodecServer

func RegisterCodecServer(s grpc.ServiceRegistrar, srv CodecServer)

Types

type CodecClient

type CodecClient interface {
	GetEncoding(ctx context.Context, in *GetEncodingRequest, opts ...grpc.CallOption) (*GetEncodingResponse, error)
	GetDecoding(ctx context.Context, in *GetDecodingRequest, opts ...grpc.CallOption) (*GetDecodingResponse, error)
	GetMaxSize(ctx context.Context, in *GetMaxSizeRequest, opts ...grpc.CallOption) (*GetMaxSizeResponse, error)
}

CodecClient is the client API for Codec service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewCodecClient

func NewCodecClient(cc grpc.ClientConnInterface) CodecClient

type CodecServer

type CodecServer interface {
	GetEncoding(context.Context, *GetEncodingRequest) (*GetEncodingResponse, error)
	GetDecoding(context.Context, *GetDecodingRequest) (*GetDecodingResponse, error)
	GetMaxSize(context.Context, *GetMaxSizeRequest) (*GetMaxSizeResponse, error)
	// contains filtered or unexported methods
}

CodecServer is the server API for Codec service. All implementations must embed UnimplementedCodecServer for forward compatibility.

type EncodingVersion

type EncodingVersion uint32
const (
	JSONEncodingVersion1 EncodingVersion = iota
	JSONEncodingVersion2
	CBOREncodingVersion
	ValuesEncodingVersion
)

enum of all known encoding formats for versioned data.

func (EncodingVersion) Uint32

func (v EncodingVersion) Uint32() uint32

type GetDecodingRequest

type GetDecodingRequest struct {
	Encoded             []byte `protobuf:"bytes,1,opt,name=encoded,proto3" json:"encoded,omitempty"`
	ItemType            string `protobuf:"bytes,2,opt,name=itemType,proto3" json:"itemType,omitempty"`
	WireEncodingVersion uint32 `protobuf:"varint,3,opt,name=wireEncodingVersion,proto3" json:"wireEncodingVersion,omitempty"`
	// contains filtered or unexported fields
}

func (*GetDecodingRequest) Descriptor deprecated

func (*GetDecodingRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetDecodingRequest.ProtoReflect.Descriptor instead.

func (*GetDecodingRequest) GetEncoded

func (x *GetDecodingRequest) GetEncoded() []byte

func (*GetDecodingRequest) GetItemType

func (x *GetDecodingRequest) GetItemType() string

func (*GetDecodingRequest) GetWireEncodingVersion

func (x *GetDecodingRequest) GetWireEncodingVersion() uint32

func (*GetDecodingRequest) ProtoMessage

func (*GetDecodingRequest) ProtoMessage()

func (*GetDecodingRequest) ProtoReflect

func (x *GetDecodingRequest) ProtoReflect() protoreflect.Message

func (*GetDecodingRequest) Reset

func (x *GetDecodingRequest) Reset()

func (*GetDecodingRequest) String

func (x *GetDecodingRequest) String() string

type GetDecodingResponse

type GetDecodingResponse struct {
	RetVal *VersionedBytes `protobuf:"bytes,1,opt,name=retVal,proto3" json:"retVal,omitempty"`
	// contains filtered or unexported fields
}

func (*GetDecodingResponse) Descriptor deprecated

func (*GetDecodingResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetDecodingResponse.ProtoReflect.Descriptor instead.

func (*GetDecodingResponse) GetRetVal

func (x *GetDecodingResponse) GetRetVal() *VersionedBytes

func (*GetDecodingResponse) ProtoMessage

func (*GetDecodingResponse) ProtoMessage()

func (*GetDecodingResponse) ProtoReflect

func (x *GetDecodingResponse) ProtoReflect() protoreflect.Message

func (*GetDecodingResponse) Reset

func (x *GetDecodingResponse) Reset()

func (*GetDecodingResponse) String

func (x *GetDecodingResponse) String() string

type GetEncodingRequest

type GetEncodingRequest struct {
	Params   *VersionedBytes `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"`
	ItemType string          `protobuf:"bytes,2,opt,name=itemType,proto3" json:"itemType,omitempty"`
	// contains filtered or unexported fields
}

func (*GetEncodingRequest) Descriptor deprecated

func (*GetEncodingRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetEncodingRequest.ProtoReflect.Descriptor instead.

func (*GetEncodingRequest) GetItemType

func (x *GetEncodingRequest) GetItemType() string

func (*GetEncodingRequest) GetParams

func (x *GetEncodingRequest) GetParams() *VersionedBytes

func (*GetEncodingRequest) ProtoMessage

func (*GetEncodingRequest) ProtoMessage()

func (*GetEncodingRequest) ProtoReflect

func (x *GetEncodingRequest) ProtoReflect() protoreflect.Message

func (*GetEncodingRequest) Reset

func (x *GetEncodingRequest) Reset()

func (*GetEncodingRequest) String

func (x *GetEncodingRequest) String() string

type GetEncodingResponse

type GetEncodingResponse struct {
	RetVal []byte `protobuf:"bytes,1,opt,name=retVal,proto3" json:"retVal,omitempty"`
	// contains filtered or unexported fields
}

func (*GetEncodingResponse) Descriptor deprecated

func (*GetEncodingResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetEncodingResponse.ProtoReflect.Descriptor instead.

func (*GetEncodingResponse) GetRetVal

func (x *GetEncodingResponse) GetRetVal() []byte

func (*GetEncodingResponse) ProtoMessage

func (*GetEncodingResponse) ProtoMessage()

func (*GetEncodingResponse) ProtoReflect

func (x *GetEncodingResponse) ProtoReflect() protoreflect.Message

func (*GetEncodingResponse) Reset

func (x *GetEncodingResponse) Reset()

func (*GetEncodingResponse) String

func (x *GetEncodingResponse) String() string

type GetMaxSizeRequest

type GetMaxSizeRequest struct {
	N           int32  `protobuf:"varint,1,opt,name=n,proto3" json:"n,omitempty"`
	ItemType    string `protobuf:"bytes,2,opt,name=itemType,proto3" json:"itemType,omitempty"`
	ForEncoding bool   `protobuf:"varint,3,opt,name=forEncoding,proto3" json:"forEncoding,omitempty"`
	// contains filtered or unexported fields
}

func (*GetMaxSizeRequest) Descriptor deprecated

func (*GetMaxSizeRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetMaxSizeRequest.ProtoReflect.Descriptor instead.

func (*GetMaxSizeRequest) GetForEncoding

func (x *GetMaxSizeRequest) GetForEncoding() bool

func (*GetMaxSizeRequest) GetItemType

func (x *GetMaxSizeRequest) GetItemType() string

func (*GetMaxSizeRequest) GetN

func (x *GetMaxSizeRequest) GetN() int32

func (*GetMaxSizeRequest) ProtoMessage

func (*GetMaxSizeRequest) ProtoMessage()

func (*GetMaxSizeRequest) ProtoReflect

func (x *GetMaxSizeRequest) ProtoReflect() protoreflect.Message

func (*GetMaxSizeRequest) Reset

func (x *GetMaxSizeRequest) Reset()

func (*GetMaxSizeRequest) String

func (x *GetMaxSizeRequest) String() string

type GetMaxSizeResponse

type GetMaxSizeResponse struct {
	SizeInBytes int32 `protobuf:"varint,1,opt,name=sizeInBytes,proto3" json:"sizeInBytes,omitempty"`
	// contains filtered or unexported fields
}

func (*GetMaxSizeResponse) Descriptor deprecated

func (*GetMaxSizeResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetMaxSizeResponse.ProtoReflect.Descriptor instead.

func (*GetMaxSizeResponse) GetSizeInBytes

func (x *GetMaxSizeResponse) GetSizeInBytes() int32

func (*GetMaxSizeResponse) ProtoMessage

func (*GetMaxSizeResponse) ProtoMessage()

func (*GetMaxSizeResponse) ProtoReflect

func (x *GetMaxSizeResponse) ProtoReflect() protoreflect.Message

func (*GetMaxSizeResponse) Reset

func (x *GetMaxSizeResponse) Reset()

func (*GetMaxSizeResponse) String

func (x *GetMaxSizeResponse) String() string

type UnimplementedCodecServer

type UnimplementedCodecServer struct{}

UnimplementedCodecServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedCodecServer) GetDecoding

func (UnimplementedCodecServer) GetEncoding

func (UnimplementedCodecServer) GetMaxSize

type UnsafeCodecServer

type UnsafeCodecServer interface {
	// contains filtered or unexported methods
}

UnsafeCodecServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CodecServer will result in compilation errors.

type VersionedBytes

type VersionedBytes struct {
	Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	Data    []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func EncodeVersionedBytes

func EncodeVersionedBytes(data any, version EncodingVersion) (*VersionedBytes, error)

func (*VersionedBytes) Descriptor deprecated

func (*VersionedBytes) Descriptor() ([]byte, []int)

Deprecated: Use VersionedBytes.ProtoReflect.Descriptor instead.

func (*VersionedBytes) GetData

func (x *VersionedBytes) GetData() []byte

func (*VersionedBytes) GetVersion

func (x *VersionedBytes) GetVersion() uint32

func (*VersionedBytes) ProtoMessage

func (*VersionedBytes) ProtoMessage()

func (*VersionedBytes) ProtoReflect

func (x *VersionedBytes) ProtoReflect() protoreflect.Message

func (*VersionedBytes) Reset

func (x *VersionedBytes) Reset()

func (*VersionedBytes) String

func (x *VersionedBytes) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL