pool

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 10 Imported by: 13

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.

Types

type Message

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

func (*Message) Context

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

func (*Message) IsModified

func (r *Message) IsModified() bool

func (*Message) IsSeparate

func (r *Message) IsSeparate() bool

func (*Message) Marshal

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

func (*Message) MessageID

func (r *Message) MessageID() uint16

func (*Message) Reset

func (r *Message) Reset()

Reset clear message for next reuse

func (*Message) SetMessageID

func (r *Message) SetMessageID(mid uint16)

func (*Message) SetModified added in v2.3.0

func (r *Message) SetModified(b bool)

func (*Message) SetType

func (r *Message) SetType(typ udp.Type)

func (*Message) String

func (r *Message) String() string

func (*Message) Type

func (r *Message) Type() udp.Type

func (*Message) Unmarshal

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

func (*Message) UpsertMessageID added in v2.5.0

func (r *Message) UpsertMessageID(mid uint16) uint16

type Pool added in v2.5.0

type Pool struct {
	// contains filtered or unexported fields
}

func New added in v2.5.0

func New(maxNumMessages uint32, maxMessageBufferSize uint16) *Pool

func (*Pool) AcquireMessage added in v2.5.0

func (p *Pool) 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 (*Pool) ConvertFrom added in v2.5.0

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

ConvertFrom converts common message to pool message.

func (*Pool) ReleaseMessage added in v2.5.0

func (p *Pool) 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.

Jump to

Keyboard shortcuts

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