respipe

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package respipe contains utilities for running pipelines on android resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitPathInfos

func EmitPathInfos(ctx context.Context, pis []*res.PathInfo) <-chan *res.PathInfo

EmitPathInfos takes the list of provided PathInfos and emits them via its returned channel.

func EmitPathInfosDir

func EmitPathInfosDir(ctx context.Context, base string) (<-chan *res.PathInfo, <-chan error)

EmitPathInfosDir descends a provided directory and emits PathInfo objects via its returned channel. It also emits any errors encountered during the walk to its error channel.

func EmitPathInfosDirs

func EmitPathInfosDirs(ctx context.Context, dirs []string) (<-chan *res.PathInfo, <-chan error)

EmitPathInfosDirs descends a provided directories and emits PathsInfo objects via its returned channel. It also emits any errors encountered during the walk to its error channel.

func Errorf

func Errorf(ctx context.Context, fmts string, a ...interface{}) error

Errorf returns a formatted error with any context sensitive information prefixed to the error

func MergeErrStreams

func MergeErrStreams(ctx context.Context, errCs []<-chan error) <-chan error

MergeErrStreams fans in multiple error streams into a single stream.

func MergePathInfoStreams

func MergePathInfoStreams(ctx context.Context, piCs []<-chan *res.PathInfo) <-chan *res.PathInfo

MergePathInfoStreams fans in multiple PathInfo streams into a single stream.

func MergeResStreams

func MergeResStreams(ctx context.Context, resCs []<-chan *rdpb.Resource) <-chan *rdpb.Resource

MergeResStreams fans in multiple Resource streams into a single stream.

func PrefixErr

func PrefixErr(ctx context.Context, add string) context.Context

PrefixErr returns a context which adds a prefix to error messages.

func SendErr

func SendErr(ctx context.Context, errC chan<- error, err error) bool

SendErr attempts to send the provided error to the provided chan, however is the context is canceled, it will return false.

func SendRes

func SendRes(ctx context.Context, resC chan<- *rdpb.Resource, r *rdpb.Resource) bool

SendRes attempts to send the provided resource to the provided chan, however is the context is canceled, it will return false.

Types

type ResInput

type ResInput struct {
	In io.Reader
}

ResInput sends all protos in the provided reader into the pipeline.

func (ResInput) Produce

func (ri ResInput) Produce(ctx context.Context) (<-chan *rdpb.Resource, <-chan error)

Produce returns a channel of resource protos encountered in the input along with a chan of errors encountered while decoding them.

type ResOutput

type ResOutput struct {
	Out io.Writer
}

ResOutput is a sink to a resource pipeline that writes all resource protos it encounters to the given writer.

func (ResOutput) Consume

func (ro ResOutput) Consume(ctx context.Context, resChan <-chan *rdpb.Resource) <-chan error

Consume takes all resource protos from the provided channel and writes them to ResOutput's writer.

Jump to

Keyboard shortcuts

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