fnfs

package
v0.0.371 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(dst WriteFS, dstFile string, src fs.FS, srcFile string) error

func CopyTo

func CopyTo(ctx context.Context, dst WriteFS, dstBasePath string, src fs.FS) error

func TotalSize

func TotalSize(ctx context.Context, fsys fs.FS) (uint64, error)

func VisitFiles

func VisitFiles(ctx context.Context, fsys fs.FS, visitor func(string, bytestream.ByteStream, fs.DirEntry) error) error

func WalkDir

func WalkDir(fsys fs.FS, dir string, callback func(string, fs.DirEntry) error) error

func WalkDirWithMatcher

func WalkDirWithMatcher(fsys fs.FS, dir string, matcher *PatternMatcher, callback func(string, fs.DirEntry) error) error

func WriteByteStream

func WriteByteStream(ctx context.Context, fs WriteFS, path string, contents bytestream.ByteStream, mode fs.FileMode) error

func WriteFSToWorkspace

func WriteFSToWorkspace(ctx context.Context, log io.Writer, vfs ReadWriteFS, src fs.FS) error

func WriteFile

func WriteFile(ctx context.Context, fs WriteFS, path string, contents []byte, mode fs.FileMode) error

func WriteFileExtended

func WriteFileExtended(ctx context.Context, dst ReadWriteFS, filePath string, mode fs.FileMode, opts WriteFileExtendedOpts, writeContents func(io.Writer) error) error

func WriteWorkspaceFile

func WriteWorkspaceFile(ctx context.Context, log io.Writer, vfs ReadWriteFS, filePath string, h func(io.Writer) error) error

Types

type ChmodFS

type ChmodFS interface {
	Chmod(path string, mode fs.FileMode) error
}

type File

type File struct {
	Path     string
	Contents []byte
}

type HasMatch

type HasMatch interface {
	Match(name string) bool
}

type LocalFS

type LocalFS interface {
	fs.ReadDirFS
	WriteFS
	MkdirFS
}

func Local

func Local(path string, rel ...string) LocalFS

func ReadWriteLocalFS

func ReadWriteLocalFS(path string, opts ...LocalOpt) LocalFS

type LocalOpt

type LocalOpt interface {
	// contains filtered or unexported methods
}

func AnnounceWrites

func AnnounceWrites(to io.Writer) LocalOpt

type Location

type Location struct {
	ModuleName string
	// FS rooted at the module [ModuleName] root.
	FS fs.FS
	// Path within the module (within [FS]).
	RelPath string
}

Identifies a package/file within a module.

func ResolveLocation

func ResolveLocation(moduleName, packageName string) (Location, bool)

func (Location) AsPackageName

func (loc Location) AsPackageName() schema.PackageName

func (Location) ErrorLocation

func (loc Location) ErrorLocation() string

Implements the fnerrors.Location interface.

func (Location) Rel

func (loc Location) Rel(rel ...string) string

func (Location) String added in v0.0.96

func (loc Location) String() string

type MatcherOpts

type MatcherOpts struct {
	IncludeFiles      []string
	IncludeFilesGlobs []string
	ExcludeFilesGlobs []string
}

type MkdirFS

type MkdirFS interface {
	MkdirAll(path string, mode fs.FileMode) error
}

type PatternMatcher

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

func NewMatcher

func NewMatcher(opts MatcherOpts) (*PatternMatcher, error)

func (*PatternMatcher) Excludes

func (m *PatternMatcher) Excludes(name string) bool

func (*PatternMatcher) Includes

func (m *PatternMatcher) Includes(name string) bool

type ReadWriteFS

type ReadWriteFS interface {
	fs.ReadDirFS
	WriteFS
}

type RmdirFS

type RmdirFS interface {
	RemoveAll(path string) error
}

type TotalSizeFS

type TotalSizeFS interface {
	TotalSize(ctx context.Context) (uint64, error)
}

type VisitFS

type VisitFS interface {
	VisitFiles(context.Context, func(string, bytestream.ByteStream, fs.DirEntry) error) error
}

type WriteFS

type WriteFS interface {
	OpenWrite(path string, mode fs.FileMode) (WriteFileHandle, error)
	Remove(path string) error
}

type WriteFileExtendedOpts

type WriteFileExtendedOpts struct {
	ContentsDigest  schema.Digest
	CompareContents bool
	FailOverwrite   bool
	EnsureFileMode  bool
	AnnounceWrite   io.Writer
}

type WriteFileHandle

type WriteFileHandle interface {
	io.WriteCloser
}

Directories

Path Synopsis
workspace

Jump to

Keyboard shortcuts

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