pool

package
Version: v2.0.0-...-691db5a Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTo

func ConvertTo(m *Message) (*message.Message, error)

ConvertTo converts pool message to common message.

func ReleaseMessage

func ReleaseMessage(req *Message)

ReleaseMessage returns req acquired via AcquireMessage to Message pool.

It is forbidden accessing req and/or its' members after returning it to Message pool.

Types

type Message

type Message struct {
	*pool.Message
	// contains filtered or unexported fields
}

func AcquireMessage

func AcquireMessage(ctx context.Context) *Message

AcquireMessage returns an empty Message instance from Message pool.

The returned Message instance may be passed to ReleaseMessage when it is no longer needed. This allows Message recycling, reduces GC pressure and usually improves performance.

func ConvertFrom

func ConvertFrom(m *message.Message) (*Message, error)

ConvertFrom converts common message to pool message.

func (*Message) Context

func (r *Message) Context() context.Context

func (*Message) IsModified

func (r *Message) IsModified() bool

func (*Message) Marshal

func (r *Message) Marshal() ([]byte, error)

func (*Message) Reset

func (r *Message) Reset()

Reset clear message for next reuse

func (*Message) Unmarshal

func (r *Message) Unmarshal(data []byte) (int, error)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL