Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrDirFileNameClash = errors.New(`mndx: file and directory have clashing names`) ErrExists = errors.New(`mndx: file has clashing name`) ErrNotExists = errors.New(`mndx: no such file or directory`) ErrNotADirectory = errors.New(`mndx: not a directory`) )
Error constants
Functions ¶
Types ¶
type File ¶
type File struct { Name string Size uint32 LocaleFlags uint32 FileDataID uint32 EncodingKey ngdp.ContentHash }
A File contains file metadata, including its content hash.
type FilenameMap ¶
A FilenameMap maps file paths to their corresponding File.
func Parse ¶
func Parse(r io.Reader) (FilenameMap, error)
Parse parses the provided MNDX file and returns a FilenameMap.
The MNDX file should not be BLTE-encoded.
func (FilenameMap) ToContentHash ¶
func (m FilenameMap) ToContentHash(fn string) (h ngdp.ContentHash, ok bool)
ToContentHash returns the content hash for a given file path.
type TreeDents ¶
type TreeDents []*TreeDirectoryEntry
A TreeDents is a sort.Interface of TreeDirectoryEntry structs.
type TreeDirectory ¶
type TreeDirectory struct {
// contains filtered or unexported fields
}
A TreeDirectory is a container for TreeDirectory or TreeFile structs, which can be addressed by their name.
func ToTree ¶
func ToTree(fileMap FilenameMap) (*TreeDirectory, error)
ToTree takes a FilenameMap and converts it into a tree structure.
func (*TreeDirectory) Get ¶
func (td *TreeDirectory) Get(filePath string) (TreeDirectoryEntry, error)
Get returns a TreeDirectoryEntry for a given /-separated path.
func (*TreeDirectory) List ¶
func (td *TreeDirectory) List() []TreeDirectoryEntry
List returns everything contained within this directory.
func (*TreeDirectory) ToContentHash ¶
func (d *TreeDirectory) ToContentHash(fn string) (h ngdp.ContentHash, ok bool)
ToContentHash returns the content hash for a given file path.
type TreeDirectoryEntry ¶
type TreeDirectoryEntry struct { Name string Directory *TreeDirectory File *TreeFile }
A TreeDirectoryEntry is a directory entry, either a nested directory or a file.