Documentation
¶
Index ¶
- Constants
- type DirMeta
- type DirMetaBuilder
- func (b *DirMetaBuilder) Add(fpath string, d fs.DirEntry, rd io.Reader, inErr error) error
- func (b *DirMetaBuilder) AddFs(fsys fs.FS) error
- func (b *DirMetaBuilder) AddTar(tr *tar.Reader) error
- func (b *DirMetaBuilder) HasErrors() bool
- func (b *DirMetaBuilder) HashReader(rd io.Reader) (int64, string, error)
- type FileMeta
- type FsDiff
Constants ¶
View Source
const SEP = "/"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirMeta ¶
type DirMeta struct { Name string Mode fs.FileMode Files map[string]*FileMeta Dirs map[string]*DirMeta }
func NewDirMeta ¶
type DirMetaBuilder ¶
type DirMetaBuilder struct { // Root of the file metadata tree Root *DirMeta // Any *recoverable* errors encountered when trying to read a path will be // added here, things like permission errors or read errors. Just because // one file can't be read doesn't mean all files can't. PathErrors map[string]error // An array of absolute paths that will be ignored Excludes []string // contains filtered or unexported fields }
Helper for filling out a DirMeta tree from a filesystem, archive, or other source.
func NewDirMetaBuilder ¶
func NewDirMetaBuilder(root *DirMeta) *DirMetaBuilder
func (*DirMetaBuilder) Add ¶
Similar to fs.WalkDirFunc but also receives a reader to read the contents of the file or nil if the entry is a directory.
func (*DirMetaBuilder) AddFs ¶
func (b *DirMetaBuilder) AddFs(fsys fs.FS) error
Calls fs.WalkDir on fsys and then adds the files and directories using b.Add.
func (*DirMetaBuilder) AddTar ¶
func (b *DirMetaBuilder) AddTar(tr *tar.Reader) error
Iterates through the tar file and calls b.Add for each entry.
func (*DirMetaBuilder) HasErrors ¶
func (b *DirMetaBuilder) HasErrors() bool
func (*DirMetaBuilder) HashReader ¶
Hashes the contents of a reader, returning the total size, hash, and any error.
type FileMeta ¶
type FsDiff ¶
type FsDiff struct { // Full paths of files that were added Added []string // Full paths of files that were removed Removed []string // Full paths of files that were modified Modified []string }
A filesystem-diff, determines a full list of files that have been added, modified, and removed.
func (*FsDiff) GetAddedModified ¶
Returns the combied list of added and modified files
Click to show internal directories.
Click to hide internal directories.