Documentation ¶
Overview ¶
Package fs defines virtual filesystem abstractions.
Index ¶
- Constants
- Variables
- func Sort(entries []Entry)
- type DeviceInfo
- type Directory
- type DirectorySummary
- type DirectoryWithSummary
- type Entry
- type EntryWithError
- type ErrorEntry
- type File
- type OwnerInfo
- type Reader
- type StreamingFile
- type Symlink
- type UTCTimestamp
- func (u UTCTimestamp) Add(dur time.Duration) UTCTimestamp
- func (u UTCTimestamp) After(other UTCTimestamp) bool
- func (u UTCTimestamp) Before(other UTCTimestamp) bool
- func (u UTCTimestamp) Equal(other UTCTimestamp) bool
- func (u UTCTimestamp) Format(layout string) string
- func (u UTCTimestamp) MarshalJSON() ([]byte, error)
- func (u UTCTimestamp) Sub(u2 UTCTimestamp) time.Duration
- func (u UTCTimestamp) ToTime() time.Time
- func (u *UTCTimestamp) UnmarshalJSON(v []byte) error
Constants ¶
const MaxFailedEntriesPerDirectorySummary = 10
MaxFailedEntriesPerDirectorySummary is the maximum number of failed entries per directory summary.
const ModBits = os.ModePerm | os.ModeSetgid | os.ModeSetuid | os.ModeSticky
ModBits is a bitmask representing the mode flags supported.
Variables ¶
var ErrEntryNotFound = errors.New("entry not found")
ErrEntryNotFound is returned when an entry is not found.
var ErrUnknown = errors.Errorf("unknown or unsupported entry type")
ErrUnknown is returned by ErrorEntry.ErrorInfo() to indicate that type of an entry is unknown.
Functions ¶
Types ¶
type DeviceInfo ¶ added in v0.8.0
DeviceInfo describes the device this filesystem entry is on.
type Directory ¶
type Directory interface { Entry Child(ctx context.Context, name string) (Entry, error) IterateEntries(ctx context.Context, cb func(context.Context, Entry) error) error // SupportsMultipleIterations returns true if the Directory supports iterating // through the entries multiple times. Otherwise it returns false. SupportsMultipleIterations() bool }
Directory represents contents of a directory.
type DirectorySummary ¶
type DirectorySummary struct { TotalFileSize int64 `json:"size"` TotalFileCount int64 `json:"files"` TotalSymlinkCount int64 `json:"symlinks"` TotalDirCount int64 `json:"dirs"` MaxModTime UTCTimestamp `json:"maxTime"` IncompleteReason string `json:"incomplete,omitempty"` // number of failed files FatalErrorCount int `json:"numFailed"` IgnoredErrorCount int `json:"numIgnoredErrors,omitempty"` // first 10 failed entries FailedEntries []*EntryWithError `json:"errors,omitempty"` }
DirectorySummary represents summary information about a directory.
func (*DirectorySummary) Clone ¶ added in v0.7.0
func (s *DirectorySummary) Clone() DirectorySummary
Clone clones given directory summary.
type DirectoryWithSummary ¶ added in v0.7.2
type DirectoryWithSummary interface {
Summary(ctx context.Context) (*DirectorySummary, error)
}
DirectoryWithSummary is optionally implemented by Directory that provide summary.
type Entry ¶
type Entry interface { os.FileInfo Owner() OwnerInfo Device() DeviceInfo LocalFilesystemPath() string // returns full local filesystem path or "" if not a local filesystem Close() // closes or recycles any resources associated with the entry, must be idempotent }
Entry represents a filesystem entry, which can be Directory, File, or Symlink.
func FindByName ¶ added in v0.11.0
FindByName returns an entry with a given name, or nil if not found. Assumes the given slice of fs.Entry is sorted.
func GetAllEntries ¶ added in v0.11.0
GetAllEntries uses IterateEntries to return all entries in a Directory.
func IterateEntriesAndFindChild ¶ added in v0.11.0
IterateEntriesAndFindChild iterates through 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
EntryWithError describes error encountered when processing an entry.
type ErrorEntry ¶ added in v0.8.0
ErrorEntry represents entry in a Directory that had encountered an error or is unknown/unsupported (ErrUnknown).
type StreamingFile ¶ added in v0.8.0
StreamingFile represents an entry that is a stream.
type UTCTimestamp ¶ added in v0.12.0
type UTCTimestamp int64
UTCTimestamp stores the UTC timestamp in nanoseconds and provides JSON serializability.
func UTCTimestampFromTime ¶ added in v0.12.0
func UTCTimestampFromTime(t time.Time) UTCTimestamp
UTCTimestampFromTime converts time.Time to UTCTimestamp.
func (UTCTimestamp) Add ¶ added in v0.12.0
func (u UTCTimestamp) Add(dur time.Duration) UTCTimestamp
Add adds the specified duration to UTC time.
func (UTCTimestamp) After ¶ added in v0.12.0
func (u UTCTimestamp) After(other UTCTimestamp) bool
After returns true if the timestamp is after another timestamp.
func (UTCTimestamp) Before ¶ added in v0.12.0
func (u UTCTimestamp) Before(other UTCTimestamp) bool
Before returns true if the timestamp is before another timestamp.
func (UTCTimestamp) Equal ¶ added in v0.12.0
func (u UTCTimestamp) Equal(other UTCTimestamp) bool
Equal returns true if the timestamp is equal to another timestamp.
func (UTCTimestamp) Format ¶ added in v0.12.0
func (u UTCTimestamp) Format(layout string) string
Format formats the timestamp according to the provided layout.
func (UTCTimestamp) MarshalJSON ¶ added in v0.12.0
func (u UTCTimestamp) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (UTCTimestamp) Sub ¶ added in v0.12.0
func (u UTCTimestamp) Sub(u2 UTCTimestamp) time.Duration
Sub returns the difference between two specified durations.
func (UTCTimestamp) ToTime ¶ added in v0.12.0
func (u UTCTimestamp) ToTime() time.Time
ToTime returns time.Time representation of the time.
func (*UTCTimestamp) UnmarshalJSON ¶ added in v0.12.0
func (u *UTCTimestamp) UnmarshalJSON(v []byte) error
UnmarshalJSON implements json.Unmarshaler.
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. |
Package virtualfs implements an in-memory abstraction of fs.Directory and fs.StreamingFile.
|
Package virtualfs implements an in-memory abstraction of fs.Directory and fs.StreamingFile. |