bytestream

package
v0.0.0-...-1831b7c Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package bytestream provides tools for working with Sandstorm's util.ByteStream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromWriteCloser

func FromWriteCloser(wc io.WriteCloser) util.ByteStream

Convert an io.WriteCloser to a util.ByteStream. WriteCloser's Write and Close methods correspond to write and done, respectively. expectSize is a no-op.

func Pipe

func Pipe() (r *io.PipeReader, w util.ByteStream)

Pipe() is like io.Pipe(), except that the write end is a ByteStream.

The ByteStream's ExpectSize method is a noop.

Once Done is called on the ByteStream, reads will return io.EOF.

If all references to the ByteStream are dropped before Done is called, further reads will return io.ErrUnexpectedEOF.

func PipeServer

func PipeServer() (r *io.PipeReader, w util.ByteStream_Server)

PipeServer() is like Pipe(), except that it returns a (ByteStream) server, rather than a client.

func ToWriteCloser

func ToWriteCloser(ctx context.Context, stream util.ByteStream) io.WriteCloser

Convert a util.ByteStream to an io.WriteCloser. The WriteCloser's Write and Close methods correspond to the bytestream's write and done methods, respectively. 'ctx' will be used when making rpc calls on the bytestream.

Note that the resulting object's Write method does not wait for the call to resolve, and thus cannot determine whether the write was successful. It will report an error if the context is canceled, and may report one if a previous call has resolved to an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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