ndjson

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineReader

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

LineReader represents a reader that reads from the underlying reader line by line, separated by '\n'.

func NewReader

func NewReader(r *bufio.Reader) *LineReader

NewReader returns a new reader, using the underlying io.Reader as input.

func (*LineReader) Read

func (r *LineReader) Read() ([]byte, error)

Read returns a single line (with '\n' ended) from the underlying reader. An error is returned iff there is an error with the underlying reader.

type Package

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

Package is the set of metadata and objects in a package.

func NewPackage

func NewPackage() *Package

NewPackage creates a new Package.

func (*Package) GetImageMeta

func (p *Package) GetImageMeta() xpkg.ImageMeta

GetImageMeta gets the ImageMeta from the package.

func (*Package) GetMeta

func (p *Package) GetMeta() []runtime.Object

GetMeta gets metadata from the package.

func (*Package) GetObjects

func (p *Package) GetObjects() []runtime.Object

GetObjects gets objects from the package.

type PackageParser

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

PackageParser is a Parser implementation for parsing packages. Specifically, is used to parse packages from NDJSON files.

func New

func New() (*PackageParser, error)

New returns a new NDJSONPackageParser

func (*PackageParser) Parse

func (p *PackageParser) Parse(ctx context.Context, reader io.ReadCloser) (*Package, error)

Parse is the underlying logic for parsing packages. It first attempts to decode objects recognized by the object scheme, then attempts to decode objects recognized by the meta scheme. Objects not recognized by either scheme return an error rather than being skipped.

Jump to

Keyboard shortcuts

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