Documentation
¶
Overview ¶
Package tree is used to represent a file hierarchy tree.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DuplicateMap ¶
type DuplicateMap map[file.PathHash][]*SignaturedNode
Map of signature to subtrees that have the same signature (i.e. duplicates).
type SignaturedNode ¶
type SignaturedNode struct {
Node *Node
Signature file.PathHash
FirstChild *SignaturedNode
NextSibling *SignaturedNode
}
Node in the tree with a signature.
type SignaturedTree ¶
type SignaturedTree struct {
// contains filtered or unexported fields
}
SignaturedTree calculates a signature for each parent node. The signature is calculated based on the children node names. One use case is to use it to determine which sub-trees are the same (i.e. duplicates).
func NewSignaturedTree ¶
func NewSignaturedTree(t Tree) SignaturedTree
Create a new signatured tree from an existing file tree.
func (*SignaturedTree) FindDuplicateSubtrees ¶
func (t *SignaturedTree) FindDuplicateSubtrees() DuplicateMap
Find all the subtrees that share the same signatures.
func (*SignaturedTree) PrintDuplicateSubtrees ¶
func (t *SignaturedTree) PrintDuplicateSubtrees(w io.Writer, printTree bool)
Find all the duplicate subtrees and display them.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree represents a file hierarchy.
func New ¶
Create a new Tree representing the file hierarchy at the specified root path. All paths are relative to this root path.
func (*Tree) PrintWithLimit ¶
Display the tree with a maximum specified depth.