streamio

package
v16.7.0-rc44 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package streamio contains wrappers intended for turning gRPC streams that send/receive messages with a []byte field into io.Writers and io.Readers.

Index

Constants

This section is empty.

Variables

View Source
var WriteBufferSize = 128 * 1024

WriteBufferSize is the largest []byte that Write() will pass to its underlying send function.

Functions

func NewReader

func NewReader(receiver func() ([]byte, error)) io.Reader

NewReader turns receiver into an io.Reader. Errors from the receiver function are passed on unmodified. This means receiver should emit io.EOF when done.

func NewSyncWriter

func NewSyncWriter(m *sync.Mutex, sender func(p []byte) error) io.Writer

NewSyncWriter turns sender into an io.Writer. The sender callback will receive []byte arguments of length at most WriteBufferSize. All calls to the sender will be synchronized via the mutex.

func NewWriter

func NewWriter(sender func(p []byte) error) io.Writer

NewWriter turns sender into an io.Writer. The sender callback will receive []byte arguments of length at most WriteBufferSize.

Types

This section is empty.

Jump to

Keyboard shortcuts

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