25 lines
732 B
Go
25 lines
732 B
Go
package filesystem
|
|
|
|
// SearchFilter is a filter to apply to search operations.
|
|
type SearchFilter func(*FileNode) bool
|
|
|
|
// FileIndexer holds and interacts with a filesystem tree.
|
|
type FileIndexer interface {
|
|
// GetNode returns the node at the given path.
|
|
GetNode(path string) (*FileNode, error)
|
|
|
|
// Search returns all child nodes matching the given filter.
|
|
Search(filter SearchFilter) []*FileNode
|
|
|
|
// GetPath returns the filesystem path for the given node.
|
|
GetPath(node *FileNode) string
|
|
|
|
// Reload reloads the entire tree from the root node.
|
|
Reload() error
|
|
|
|
// ReloadFrom reloads from a specific node in the tree.
|
|
ReloadFrom(node *FileNode) error
|
|
|
|
// Count returns the amount of nodes in the indexer tree.
|
|
Count() int
|
|
}
|