tlc

package
v0.0.0-...-cc4284e Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 18 Imported by: 8

Documentation

Overview

Package tlc is a generated protocol buffer package.

It is generated from these files:

tlc/tlc.proto

It has these top-level messages:

Container
Dir
File
Symlink

Index

Constants

View Source
const (
	ForEachContinue = 1
	ForEachBreak    = 2
)
View Source
const (
	// ModeMask is or'd with files being diffed
	ModeMask = 0o644

	// NullPath can be specified instead of a directory to yield an empty container
	NullPath = "/dev/null"
)

Variables

View Source
var (
	ErrUnrecognizedContainer = errors.New("Unrecognized container: should either be a directory, or a .zip archive")
)

Functions

This section is empty.

Types

type Container

type Container struct {
	Files    []*File    `protobuf:"bytes,1,rep,name=files" json:"files,omitempty"`
	Dirs     []*Dir     `protobuf:"bytes,2,rep,name=dirs" json:"dirs,omitempty"`
	Symlinks []*Symlink `protobuf:"bytes,3,rep,name=symlinks" json:"symlinks,omitempty"`
	Size     int64      `protobuf:"varint,16,opt,name=size" json:"size,omitempty"`
}

func WalkAny

func WalkAny(containerPath string, opts WalkOpts) (*Container, error)

WalkAny tries to retrieve container information on containerPath. It supports: the empty container (/dev/null), local directories, zip archives, or single files

func WalkDir

func WalkDir(basePathIn string, opts WalkOpts) (*Container, error)

WalkDir retrieves information on all files, directories, and symlinks in a directory

func WalkSingle

func WalkSingle(file eos.File) (*Container, error)

WalkSingle returns a container with a single file

func WalkZip

func WalkZip(zr *zip.Reader, opts WalkOpts) (*Container, error)

WalkZip walks all file in a zip archive and returns a container Note: WalkZip does not respect filter

func (*Container) AssertCaseInsensitiveSafe

func (c *Container) AssertCaseInsensitiveSafe() error

AssertCaseInsensitiveSafe returns an error if there exists multiple entries that differ only by their casing, like `foo/bar` and `foo/BAR`

func (*Container) Clone

func (c *Container) Clone() *Container

Clone returns a deep clone of this container

func (*Container) Descriptor

func (*Container) Descriptor() ([]byte, []int)

func (*Container) EnsureEqual

func (c1 *Container) EnsureEqual(c2 *Container) error

func (*Container) FixPermissions

func (c *Container) FixPermissions(pool lake.Pool) error

func (*Container) ForEachEntry

func (c *Container) ForEachEntry(f func(e Entry) ForEachOutcome)

ForEachEntry iterates through all entries of a container Return `true` to break

func (*Container) Format

func (container *Container) Format(f fmt.State, c rune)

Stats return a human-readable summary of the contents of a container

func (*Container) GetDirs

func (m *Container) GetDirs() []*Dir

func (*Container) GetFiles

func (m *Container) GetFiles() []*File
func (m *Container) GetSymlinks() []*Symlink

func (*Container) IsSingleFile

func (container *Container) IsSingleFile() bool

IsSingleFile returns true if the container contains exactly one files, and no directories or symlinks.

func (*Container) Prepare

func (c *Container) Prepare(basePath string) error

Prepare creates all directories, files, and symlinks. It also applies the proper permissions if the files already exist

func (*Container) Print

func (container *Container) Print(output WriteLine)

func (*Container) ProtoMessage

func (*Container) ProtoMessage()

func (*Container) Reset

func (m *Container) Reset()

func (*Container) Stats

func (container *Container) Stats() string

Stats return a human-readable summary of the contents of a container

func (*Container) String

func (m *Container) String() string

func (*Container) Validate

func (container *Container) Validate() error

Validate verifies that the container doesn't contain wildly invalid stuff, like a directory and a file having the same name

type Dir

type Dir struct {
	Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"`
	Mode uint32 `protobuf:"varint,2,opt,name=mode" json:"mode,omitempty"`
}

func (*Dir) Descriptor

func (*Dir) Descriptor() ([]byte, []int)

func (*Dir) GetMode

func (d *Dir) GetMode() uint32

func (*Dir) GetPath

func (d *Dir) GetPath() string

func (*Dir) ProtoMessage

func (*Dir) ProtoMessage()

func (*Dir) Reset

func (m *Dir) Reset()

func (*Dir) SetMode

func (d *Dir) SetMode(mode uint32)

func (*Dir) SetPath

func (d *Dir) SetPath(path string)

func (*Dir) String

func (m *Dir) String() string

func (*Dir) ToString

func (f *Dir) ToString() string

type Entry

type Entry interface {
	GetPath() string
	SetPath(path string)

	GetMode() uint32
	SetMode(mode uint32)
}

type File

type File struct {
	Path   string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"`
	Mode   uint32 `protobuf:"varint,2,opt,name=mode" json:"mode,omitempty"`
	Size   int64  `protobuf:"varint,3,opt,name=size" json:"size,omitempty"`
	Offset int64  `protobuf:"varint,4,opt,name=offset" json:"offset,omitempty"`
}

func (*File) Descriptor

func (*File) Descriptor() ([]byte, []int)

func (*File) GetMode

func (f *File) GetMode() uint32

func (*File) GetPath

func (f *File) GetPath() string

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) Reset

func (m *File) Reset()

func (*File) SetMode

func (f *File) SetMode(mode uint32)

func (*File) SetPath

func (f *File) SetPath(path string)

func (*File) String

func (m *File) String() string

func (*File) ToString

func (f *File) ToString() string

type FilterFunc

type FilterFunc func(name string) FilterResult

A FilterFunc allows ignoring certain files or directories when walking the filesystem When a directory is ignored by a FilterFunc, all its children are, too!

var KeepAllFilter FilterFunc = func(name string) FilterResult {
	return FilterKeep
}

KeepAllFilter is a passthrough that filters out no files at all

var PresetFilter FilterFunc = func(name string) FilterResult {
	for _, pattern := range baseIgnoredPaths {
		match, _ := filepath.Match(pattern, name)
		if match {
			return FilterIgnore
		}
	}
	return FilterKeep
}

PresetFilter is a base filter that ignores git/hg/svn metadata, some macOS and Windows metadata, and the `.itch` folder

type FilterResult

type FilterResult int
const (
	FilterKeep   FilterResult = 1
	FilterIgnore FilterResult = 2
)

type ForEachOutcome

type ForEachOutcome int
type Symlink struct {
	Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"`
	Mode uint32 `protobuf:"varint,2,opt,name=mode" json:"mode,omitempty"`
	Dest string `protobuf:"bytes,3,opt,name=dest" json:"dest,omitempty"`
}

func (*Symlink) Descriptor

func (*Symlink) Descriptor() ([]byte, []int)

func (*Symlink) GetMode

func (s *Symlink) GetMode() uint32

func (*Symlink) GetPath

func (s *Symlink) GetPath() string

func (*Symlink) ProtoMessage

func (*Symlink) ProtoMessage()

func (*Symlink) Reset

func (m *Symlink) Reset()

func (*Symlink) SetMode

func (s *Symlink) SetMode(mode uint32)

func (*Symlink) SetPath

func (s *Symlink) SetPath(path string)

func (*Symlink) String

func (m *Symlink) String() string

func (*Symlink) ToString

func (f *Symlink) ToString() string

type WalkOpts

type WalkOpts struct {
	// "Wrapping" solves the problem where we're walking:
	// /foo/bar/Sample.app
	// But we want all files, dirs and symlinks in the container to start with "Sample.app/".
	//
	// What we do is we adjust the walked path to:
	// /foo/bar
	// And we set `WrappedDir` to `Sample.app`.
	//
	// This is only used by `WalkDir`. It behaves as if the `/foo/bar` directory
	// only contained `Sample.app`, and nothing else.
	WrappedDir string

	// Filter decides which files to exclude from the walk
	Filter FilterFunc

	// Dereference walks symlinks as if they were their targets
	Dereference bool
}

func (*WalkOpts) AutoWrap

func (opts *WalkOpts) AutoWrap(containerPathPtr *string, consumer *state.Consumer)

Wrap the container path if it's a directory, and it ends in .app

func (*WalkOpts) GetFilter

func (opts *WalkOpts) GetFilter() FilterFunc

func (*WalkOpts) Wrap

func (opts *WalkOpts) Wrap(containerPathPtr *string)

Wrap the container path if it's a directory

type WriteLine

type WriteLine func(line string)

Jump to

Keyboard shortcuts

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