fork/gdu

git clone https://git.julia.blue/fork/gdu

ShivamB25feat: stop scanning and keep partial results (#606)99a7f2a

master
1.1 KiB39 linesraw
1// Package common contains commong logic and interfaces used across Gdu
2// nolint: revive //Why: this is common package
3package common
4
5import (
6	"time"
7
8	"github.com/dundee/gdu/v5/pkg/fs"
9)
10
11// CurrentProgress struct
12type CurrentProgress struct {
13	CurrentItemName string
14	ItemCount       int64
15	TotalUsage      int64
16}
17
18// ShouldDirBeIgnored whether path should be ignored
19type ShouldDirBeIgnored func(name, path string) bool
20
21// ShouldFileBeIgnored whether file should be ignored based on type
22type ShouldFileBeIgnored func(name string) bool
23
24// Analyzer is type for dir analyzing function
25type Analyzer interface {
26	AnalyzeDir(path string, ignore ShouldDirBeIgnored, fileTypeFilter ShouldFileBeIgnored) fs.Item
27	SetFollowSymlinks(bool)
28	SetShowAnnexedSize(bool)
29	SetTimeFilter(timeFilter TimeFilter)
30	SetArchiveBrowsing(bool)
31	SetFileTypeFilter(filter ShouldFileBeIgnored)
32	Cancel()
33	GetDone() SignalGroup
34	GetProgress() CurrentProgress
35	ResetProgress()
36}
37
38// TimeFilter represents a function that determines if a file should be included based on its mtime
39type TimeFilter func(mtime time.Time) bool