fs

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Overview

Package fs defines virtual filesystem abstractions.

Index

Constants

View Source
const MaxFailedEntriesPerDirectorySummary = 10

MaxFailedEntriesPerDirectorySummary is the maximum number of failed entries per directory summary.

Variables

View Source
var ErrEntryNotFound = errors.New("entry not found")

ErrEntryNotFound is returned when an entry is not found.

Functions

This section is empty.

Types

type Directory

type Directory interface {
	Entry
	Child(ctx context.Context, name string) (Entry, error)
	Readdir(ctx context.Context) (Entries, error)
	Summary() *DirectorySummary
}

Directory represents contents of a directory.

type DirectorySummary

type DirectorySummary struct {
	TotalFileSize    int64     `json:"size"`
	TotalFileCount   int64     `json:"files"`
	TotalDirCount    int64     `json:"dirs"`
	MaxModTime       time.Time `json:"maxTime"`
	IncompleteReason string    `json:"incomplete,omitempty"`

	// number of failed files
	NumFailed int `json:"numFailed"`

	// first 10 failed entries
	FailedEntries []*EntryWithError `json:"errors,omitempty"`
}

DirectorySummary represents summary information about a directory.

type Entries

type Entries []Entry

Entries is a list of entries sorted by name.

func (Entries) FindByName

func (e Entries) FindByName(n string) Entry

FindByName returns an entry with a given name, or nil if not found.

func (Entries) Remove added in v0.4.0

func (e Entries) Remove(name string) Entries

Remove returns a copy of Entries with the provided entry removed, while maintaining sorted order.

func (Entries) Sort

func (e Entries) Sort()

Sort sorts the entries by name.

func (Entries) Update added in v0.4.0

func (e Entries) Update(newEntry Entry) Entries

Update returns a copy of Entries with the provided entry included, by either replacing existing entry with the same name or inserted in the appropriate place to maintain sorted order.

type Entry

type Entry interface {
	os.FileInfo
	Owner() OwnerInfo
}

Entry represents a filesystem entry, which can be Directory, File, or Symlink

func ReadDirAndFindChild added in v0.4.0

func ReadDirAndFindChild(ctx context.Context, d Directory, name string) (Entry, error)

ReadDirAndFindChild reads all entries from a directory and returns one by name. This is a convenience function that may be helpful in implementations of Directory.Child()

type EntryWithError added in v0.6.0

type EntryWithError struct {
	EntryPath string `json:"path"`
	Error     string `json:"error"`
}

EntryWithError describes error encountered when processing an entry

type File

type File interface {
	Entry
	Open(ctx context.Context) (Reader, error)
}

File represents an entry that is a file.

type OwnerInfo

type OwnerInfo struct {
	UserID  uint32
	GroupID uint32
}

OwnerInfo describes owner of a filesystem entry

type Reader

type Reader interface {
	io.ReadCloser
	io.Seeker

	Entry() (Entry, error)
}

Reader allows reading from a file and retrieving its up-to-date file info.

type Symlink interface {
	Entry
	Readlink(ctx context.Context) (string, error)
}

Symlink represents a symbolic link entry.

Directories

Path Synopsis
Package cachefs implements a wrapper that caches filesystem actions.
Package cachefs implements a wrapper that caches filesystem actions.
Package ignorefs implements a wrapper that hides ignored files listed in '.kopiaignore' and in policies attached to directories.
Package ignorefs implements a wrapper that hides ignored files listed in '.kopiaignore' and in policies attached to directories.
Package localfs implements virtual filesystem abstraction for a local filesystem.
Package localfs implements virtual filesystem abstraction for a local filesystem.
Package loggingfs implements a wrapper that logs all filesystem actions.
Package loggingfs implements a wrapper that logs all filesystem actions.

Jump to

Keyboard shortcuts

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