message

package
v0.0.0-...-4c661ef Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefCompMethod NoCompression = NoCompression(0)
	FlateMethod   Flate         = Flate(1)
)

Variables

View Source
var File_message_message_proto protoreflect.FileDescriptor

Functions

func Unpack

func Unpack(msg *Message) ([]byte, error)

Types

type Compression

type Compression interface {
	Compress(dst io.Writer, src []byte, level int) error
	Decompress(dst []byte, src io.Reader) error
}

type Flate

type Flate uint32

func (Flate) Compress

func (Flate) Compress(compressing io.Writer, raw []byte, level int) error

func (Flate) Decompress

func (Flate) Decompress(raw []byte, compressing io.Reader) error

type Message

type Message struct {
	Compression uint32 `protobuf:"varint,1,opt,name=Compression,proto3" json:"Compression,omitempty"`
	Length      uint32 `protobuf:"varint,3,opt,name=Length,proto3" json:"Length,omitempty"`
	Content     []byte `protobuf:"bytes,4,opt,name=Content,proto3" json:"Content,omitempty"`
	// contains filtered or unexported fields
}

func Pack

func Pack(p []byte, method Compression) (*Message, error)

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetCompression

func (x *Message) GetCompression() uint32

func (*Message) GetContent

func (x *Message) GetContent() []byte

func (*Message) GetLength

func (x *Message) GetLength() uint32

func (*Message) Marshal

func (x *Message) Marshal(_ any) ([]byte, error)

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

func (*Message) Unmarshal

func (x *Message) Unmarshal(_ []byte, _ any) error

type Msg

type Msg interface {
	Marshal(any) ([]byte, error)
	Unmarshal([]byte, any) error
}

type NoCompression

type NoCompression uint32

func (NoCompression) Compress

func (NoCompression) Compress(dst io.Writer, src []byte, level int) error

func (NoCompression) Decompress

func (NoCompression) Decompress(dst []byte, src io.Reader) error

Jump to

Keyboard shortcuts

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