Fileserver/internal/filesystem/indexer.go
2025-08-13 09:44:02 +02:00

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
}