memfs

package
v0.0.139 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeferSnapshot added in v0.0.109

func DeferSnapshot(fsys fs.FS, opts SnapshotOpts) compute.Computable[fs.FS]

func DirHandle

func DirHandle(basename string, entries []fs.DirEntry) fs.ReadDirFile

func FileHandle

func FileHandle(f fnfs.File) fs.File

Types

type FS

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

func Snapshot

func Snapshot(fsys fs.FS, opts SnapshotOpts) (*FS, error)

func SnapshotDir

func SnapshotDir(fsys fs.FS, dir string, opts SnapshotOpts) (*FS, error)

func (*FS) Add

func (m *FS) Add(path string, contents []byte)

func (*FS) Clone

func (m *FS) Clone() fnfs.ReadWriteFS

func (*FS) ComputeDigest

func (m *FS) ComputeDigest(ctx context.Context) (schema.Digest, error)

func (*FS) Open

func (m *FS) Open(name string) (fs.File, error)

func (*FS) OpenWrite

func (m *FS) OpenWrite(name string, _ fs.FileMode) (fnfs.WriteFileHandle, error)

func (*FS) ReadDir

func (m *FS) ReadDir(relPath string) ([]fs.DirEntry, error)

func (*FS) Remove

func (m *FS) Remove(relPath string) error

func (*FS) Stats

func (m *FS) Stats() FSStats

func (*FS) TotalSize

func (m *FS) TotalSize(ctx context.Context) (uint64, error)

func (*FS) VisitFiles

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

func (*FS) VisitFilesWithoutContext

func (m *FS) VisitFilesWithoutContext(visitor func(string, bytestream.Static, FileDirent) error) error

type FSStats

type FSStats struct {
	FileCount int
}

type FileDirent

type FileDirent struct {
	Path        string
	ContentSize int64
	FileMode    fs.FileMode
}

func (FileDirent) Info

func (f FileDirent) Info() (fs.FileInfo, error)

func (FileDirent) IsDir

func (f FileDirent) IsDir() bool

func (FileDirent) ModTime

func (f FileDirent) ModTime() time.Time

func (FileDirent) Mode

func (f FileDirent) Mode() fs.FileMode

func (FileDirent) Name

func (f FileDirent) Name() string

func (FileDirent) Size

func (f FileDirent) Size() int64

func (FileDirent) Sys

func (f FileDirent) Sys() interface{}

func (FileDirent) Type

func (f FileDirent) Type() fs.FileMode

type SnapshotFS

type SnapshotFS interface {
	Snapshot(SnapshotOpts) (*FS, error)
}

type SnapshotOpts

type SnapshotOpts struct {
	RequireIncludeFiles bool
	IncludeFiles        []string
	IncludeFilesGlobs   []string
	ExcludeFilesGlobs   []string
}

type WithMatch

type WithMatch interface {
	Match(name string) bool
}

func ExcludeMatcher

func ExcludeMatcher(globs []string) (WithMatch, error)

Jump to

Keyboard shortcuts

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