parser

package
v0.0.0-...-9981174 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataHandlerFunc

type DataHandlerFunc func(r io.Reader, dt string, uf UpdateFile) error

DataHandlerFunc is a user provided update data stream handler. Parameter `r` is a decompressed data stream, `dt` holds current device type, `uf` contains basic information about update. The handler shall return nil if no errors occur.

type GenericParser

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

func (*GenericParser) ArchiveData

func (rp *GenericParser) ArchiveData(tw *tar.Writer, src, dst string) error

func (*GenericParser) ArchiveHeader

func (rp *GenericParser) ArchiveHeader(tw *tar.Writer, src, dst string, updFiles []string) error

func (*GenericParser) Copy

func (rp *GenericParser) Copy() Parser

func (*GenericParser) GetDeviceType

func (rp *GenericParser) GetDeviceType() string

func (*GenericParser) GetMetadata

func (rp *GenericParser) GetMetadata() *metadata.AllMetadata

func (*GenericParser) GetUpdateFiles

func (rp *GenericParser) GetUpdateFiles() map[string]UpdateFile

func (*GenericParser) GetUpdateType

func (rp *GenericParser) GetUpdateType() *metadata.UpdateType

func (*GenericParser) ParseData

func (rp *GenericParser) ParseData(r io.Reader) error

data files are stored in tar.gz format

func (*GenericParser) ParseHeader

func (rp *GenericParser) ParseHeader(tr *tar.Reader, hdr *tar.Header, hPath string) error

type ParseManager

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

func NewParseManager

func NewParseManager() *ParseManager

func (*ParseManager) GetGeneric

func (p *ParseManager) GetGeneric() Parser

func (*ParseManager) GetRegistered

func (p *ParseManager) GetRegistered(parsingType string) (Parser, error)

func (*ParseManager) GetWorker

func (p *ParseManager) GetWorker(update string) (Parser, error)

func (*ParseManager) GetWorkers

func (p *ParseManager) GetWorkers() Workers

func (*ParseManager) PushWorker

func (p *ParseManager) PushWorker(parser Parser, update string) error

func (*ParseManager) Register

func (p *ParseManager) Register(parser Parser) error

func (*ParseManager) SetGeneric

func (p *ParseManager) SetGeneric(parser Parser)

type Parser

type Parser interface {
	Reader
	Writer
}

type Reader

type Reader interface {
	ParseHeader(tr *tar.Reader, hdr *tar.Header, hPath string) error
	ParseData(r io.Reader) error

	GetUpdateType() *metadata.UpdateType
	GetUpdateFiles() map[string]UpdateFile
	GetDeviceType() string
	GetMetadata() *metadata.AllMetadata
}

type RootfsParser

type RootfsParser struct {
	W         io.Writer       // output stream the update gets written to
	ScriptDir string          // output directory for scripts
	DataFunc  DataHandlerFunc // custom update data handler
	// contains filtered or unexported fields
}

RootfsParser handles updates of type 'image-rootfs'. The parser can be initialized setting `W` (io.Writer the update data gets written to), or `DataFunc` (user provided callback that handlers the update data stream).

func (*RootfsParser) ArchiveData

func (rp *RootfsParser) ArchiveData(tw *tar.Writer, src, dst string) error

func (*RootfsParser) ArchiveHeader

func (rp *RootfsParser) ArchiveHeader(tw *tar.Writer,
	src, dst string, updFiles []string) error

func (*RootfsParser) Copy

func (rp *RootfsParser) Copy() Parser

func (*RootfsParser) GetDeviceType

func (rp *RootfsParser) GetDeviceType() string

func (*RootfsParser) GetImageID

func (rp *RootfsParser) GetImageID() string

func (*RootfsParser) GetMetadata

func (rp *RootfsParser) GetMetadata() *metadata.AllMetadata

func (*RootfsParser) GetUpdateFiles

func (rp *RootfsParser) GetUpdateFiles() map[string]UpdateFile

func (*RootfsParser) GetUpdateType

func (rp *RootfsParser) GetUpdateType() *metadata.UpdateType

func (*RootfsParser) ParseData

func (rp *RootfsParser) ParseData(r io.Reader) error

data files are stored in tar.gz format

func (*RootfsParser) ParseHeader

func (rp *RootfsParser) ParseHeader(tr *tar.Reader, hdr *tar.Header, hPath string) error

type UpdateFile

type UpdateFile struct {
	Name      string
	Path      string
	Size      int64
	Date      time.Time
	Checksum  []byte
	Signature []byte
}

type Workers

type Workers map[string]Parser

type Writer

type Writer interface {
	ArchiveHeader(tw *tar.Writer, srcDir, dstDir string, updFiles []string) error
	ArchiveData(tw *tar.Writer, srcDir, dst string) error
	Copy() Parser
}

Jump to

Keyboard shortcuts

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