payload

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 6 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal added in v0.6.0

func Equal(a Payload, b Payload) bool

Equal returns true if payloads have same data and metadata.

Types

type Payload

type Payload interface {
	// Metadata returns raw metadata bytes.
	// The ok result indicates whether metadata exists.
	Metadata() (metadata []byte, ok bool)
	// MetadataUTF8 returns metadata as UTF8 string.
	// The ok result indicates whether metadata exists.
	MetadataUTF8() (metadata string, ok bool)
	// Data returns raw data bytes.
	Data() []byte
	// DataUTF8 returns data as UTF8 string.
	DataUTF8() string
}

Payload is a stream message (upstream or downstream). It contains data associated with a stream created by a previous request. In Reactive Streams and Rx this is the 'onNext' event.

func Clone

func Clone(payload Payload) Payload

Clone create a copy of original payload.

func Empty added in v0.7.8

func Empty() Payload

Empty returns an empty Payload.

func MustNewFile

func MustNewFile(filename string, metadata []byte) Payload

MustNewFile create a new payload from file.

func New

func New(data []byte, metadata []byte) Payload

New create a new payload with bytes.

func NewFile

func NewFile(filename string, metadata []byte) (Payload, error)

NewFile create a new payload from file.

func NewString

func NewString(data, metadata string) Payload

NewString create a new payload with strings.

type SetupPayload

type SetupPayload interface {
	Payload
	// DataMimeType returns MIME type of data.
	DataMimeType() string
	// MetadataMimeType returns MIME type of metadata.
	MetadataMimeType() string
	// TimeBetweenKeepalive returns interval duration of keepalive.
	TimeBetweenKeepalive() time.Duration
	// MaxLifetime returns max lifetime of RSocket connection.
	MaxLifetime() time.Duration
	// Version return RSocket protocol version.
	Version() core.Version
}

SetupPayload is particular payload for RSocket Setup.

Jump to

Keyboard shortcuts

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