jsonmsgs

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageStreamer

type MessageStreamer interface {
	io.ReadCloser
	JSONMessages(ctx context.Context) iter.Seq2[jsonstream.Message, error]
	Wait(ctx context.Context) error
}

MessageStreamer abstracts Moby's API client client.ImagePullResponse and client.ImagePushResponse. Unfortunately, moby's client implementation is internal, so we have to somehow mock it here in order to use it our mock tests.

type Streamer

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

Streamer implements MessageStreamer.

func New

func New(rc io.ReadCloser) *Streamer

New returns a new JSON message streamer; it panics when given a nil io.ReadCloser.

func (Streamer) Close

func (s Streamer) Close() error

Close the message streamer, returning any error. Close is idempotent, closing the io.ReaderCloser only once and returning any error on this first close on any later calls.

func (Streamer) JSONMessages

func (s Streamer) JSONMessages(ctx context.Context) iter.Seq2[jsonstream.Message, error]

JSONMessages iterates over all messages from a stream.

func (Streamer) Read

func (s Streamer) Read(p []byte) (n int, err error)

Read from the message streamer.

func (Streamer) Wait

func (s Streamer) Wait(ctx context.Context) error

Wait until the stream completes, returning an error if the context was cancelled, decoding failed, transport failed, or a JSON error message was received.

Jump to

Keyboard shortcuts

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