chunk

package
v14.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunker

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

Chunker lets you spread items you want to send over multiple chunks. This type is not thread-safe.

func New

func New(s Sender) *Chunker

New returns a new Chunker.

func (*Chunker) Flush

func (c *Chunker) Flush() error

Flush sends remaining items in the current chunk, if any.

func (*Chunker) Send

func (c *Chunker) Send(it proto.Message) error

Send will append an item to the current chunk and send the chunk if it is full.

type Sender

type Sender interface {
	// Reset should create a fresh response message.
	Reset()
	// Append should append the given item to the slice in the current response message
	Append(proto.Message)
	// Send should send the current response message
	Send() error
}

Sender encapsulates a gRPC response stream and the current chunk that's being built.

Reset, Append, [Append...], Send, Reset, Append, [Append...], Send, ...

Jump to

Keyboard shortcuts

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