gen

package
v0.0.0-...-d5b5c0c Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 2 << 9
	MB = 2 << 19
	GB = 2 << 29
)

Size constants.

Variables

This section is empty.

Functions

func MakeChans

func MakeChans() (chan Job, chan Done, chan struct{}, chan error)

Types

type Done

type Done struct {
	Name                 string
	Size, CompressedSize int64
}

type Encoder

type Encoder interface {
	Create(name string) (io.WriteCloser, error)
	Finalize() error
}

type Gen

type Gen struct {
	From, To fs.FS
	compress.Level

	SkipFinalize bool

	path.Matcher
}

Gen uses Operate to process files in the FS given as From, and copies its output to To after processing is completed successfully. It only operates on names matched by the Matcher. It uses a temporary buffer for staging before completion.

func (Gen) Operate

func (g Gen) Operate() error

Operate processes files as in the description of the type.

type GitModule

type GitModule struct {
	Overwrite bool

	// Remote specifies the full path to the remote, including e.g.
	// protocol.  Local is the local name that the repo will be
	// cloned into.  Revision (optional) defines a specific revision
	// to be checked out, such as a tag, commit id, or branch.  If
	// Branch is set, it will be used in git submodule commands.
	Remote, Local, Branch, Revision string
}

GitModule is an optional job which can be added to a Gen pipeline to clone a given Git repository into the local repo.

func (GitModule) Operate

func (g GitModule) Operate(root string) error

Operate checks for the presence of the Git submodule in the given relative path. If the working directory is not in a Git repo, the GitModule is cloned directly into the target root.

If the working directory is in a Git repo, Operate checks for the GitModule as a submodule of the Git repo, in the given path. If it is not a submodule in the given path, or if g.Overwrite is true, the GitModule is added there as a git submodule using git from the shell.

If it is present, and Overwrite is false, it is ignored.

TODO: Check for a particular revision.

type Job

type Job struct{ Name string }

type Target

type Target interface {
	io.ReaderFrom
	io.Reader
}

Target defines the output formatting of a target language (e.g. C++).

type Work

type Work struct {
	Jobs <-chan Job
	Done chan<- Done
	Kill <-chan struct{}
	Errs chan<- error

	// The Encoder is responsible for creating and finalizing the
	// output files for the specific implementation.
	Encoder
	// contains filtered or unexported fields
}

func (Work) Process

func (w Work) Process(path string) (none Done, err error)

Process encodes the file into a buffer using LZ4 and returns it. When it is finished, the finished file is in w.tmp.

func (Work) Run

func (w Work) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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