smash

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TreeNextChild = "├─"
	TreeLastChild = "└─"
)
View Source
const (
	GithubHomeText  = "github.com/thushan/smash"
	GithubHomeUri   = "https://github.com/thushan/smash"
	GithubLatestUri = "https://github.com/thushan/smash/releases/latest"
)
View Source
const ReportOutputTemplate = "report-*.json"

Variables

View Source
var (
	Version = "v0.9.0"
	Commit  = "none"
	Date    = "unknown"
	Time    = "nowish"
	User    = "local"
)

Functions

func PrintNerdStats added in v0.0.7

func PrintNerdStats(stats nerdstats.NerdStats, context string)

func PrintRunSummary added in v0.0.7

func PrintRunSummary(rs RunSummary, flags *Flags)

func PrintVersionInfo

func PrintVersionInfo(extendedInfo bool)

func SummariseSmashedFile added in v0.0.7

func SummariseSmashedFile(stats slicer.SlicerStats, ffs *indexer.FileFS, ms int64, duplicates *xsync.MapOf[string, *DuplicateFiles], empty *EmptyFiles)

Types

type App

type App struct {
	Flags     *Flags
	Session   *AppSession
	Runtime   *AppRuntime
	Summary   *RunSummary
	Args      []string
	Locations []indexer.LocationFS
}

func (*App) Exec added in v0.0.4

func (app *App) Exec() error

func (*App) Export added in v0.0.7

func (app *App) Export(filePath string) (string, error)

func (*App) ExportFile added in v0.0.7

func (app *App) ExportFile(f *os.File) error

func (*App) ExportReport added in v0.0.7

func (app *App) ExportReport()

func (*App) GenerateReportOutput added in v0.0.7

func (app *App) GenerateReportOutput() ReportOutput

func (*App) PrintRunAnalysis added in v0.0.4

func (app *App) PrintRunAnalysis(ignoreEmptyFiles bool)

func (*App) Run

func (app *App) Run() error

type AppRuntime added in v0.0.4

type AppRuntime struct {
	Slicer        *slicer.Slicer
	SlicerOptions *slicer.Options
	IndexerConfig *indexer.IndexerConfig
	Files         chan *indexer.FileFS
}

type AppSession added in v0.0.3

type AppSession struct {
	Dupes     *xsync.MapOf[string, *DuplicateFiles]
	Fails     *xsync.MapOf[string, error]
	Empty     *EmptyFiles
	StartTime int64
	EndTime   int64
}

type DuplicateFiles added in v0.0.7

type DuplicateFiles struct {
	Files []File
	sync.RWMutex
}

type EmptyFiles added in v0.0.7

type EmptyFiles struct {
	Files []File
	sync.RWMutex
}

type File added in v0.0.7

type File struct {
	Filename    string
	Location    string
	Path        string
	Base        string
	Hash        string
	FileSizeF   string
	FileSize    uint64
	ElapsedTime int64
	FullHash    bool
	EmptyFile   bool
}

type Flags

type Flags struct {
	OutputFile      string   `yaml:"output"`
	Base            []string `yaml:"base"`
	ExcludeDir      []string `yaml:"exclude-dir"`
	ExcludeFile     []string `yaml:"exclude-file"`
	MinSize         int64    `yaml:"min-size"`
	MaxSize         int64    `yaml:"max-size"`
	SliceThreshold  int64    `yaml:"slice-threshold"`
	SliceSize       int64    `yaml:"slice-size"`
	Slices          int      `yaml:"slices"`
	Algorithm       int      `yaml:"algorithm"`
	MaxThreads      int      `yaml:"max-threads"`
	MaxWorkers      int      `yaml:"max-workers"`
	ProgressUpdate  int      `yaml:"progress-update"`
	ShowTop         int      `yaml:"show-top"`
	DisableSlicing  bool     `yaml:"disable-slicing"`
	DisableMeta     bool     `yaml:"disable-meta"`
	DisableAutoText bool     `yaml:"disable-autotext"`
	IgnoreEmpty     bool     `yaml:"ignore-empty"`
	IgnoreHidden    bool     `yaml:"ignore-hidden"`
	IgnoreSystem    bool     `yaml:"ignore-system"`
	ShowVersion     bool     `yaml:"version"`
	ShowNerdStats   bool     `yaml:"nerd-stats"`
	Recurse         bool     `yaml:"recurse"`
	ShowDuplicates  bool     `yaml:"show-duplicates"`
	Silent          bool     `yaml:"silent"`
	HideTopList     bool     `yaml:"no-top-list"`
	HideProgress    bool     `yaml:"no-progress"`
	HideOutput      bool     `yaml:"no-output"`
	Profile         bool     `yaml:"profile"`
	Verbose         bool     `yaml:"verbose"`
}

type ReportDuplicateSummary added in v0.0.7

type ReportDuplicateSummary struct {
	Duplicates []ReportFileSummary `json:"duplicates"`
	ReportFileSummary
}

type ReportFailSummary added in v0.0.7

type ReportFailSummary struct {
	Filename string `json:"filename"`
	Error    string `json:"error"`
}

type ReportFileBaseSummary added in v0.0.7

type ReportFileBaseSummary struct {
	Filename string `json:"filename"`
	Location string `json:"location"`
	Path     string `json:"path"`
}

type ReportFileSummary added in v0.0.7

type ReportFileSummary struct {
	ReportFileBaseSummary
	Hash     string `json:"hash"`
	Size     uint64 `json:"size"`
	FullHash bool   `json:"fullHash"`
}

type ReportFiles added in v0.0.7

type ReportFiles struct {
	Fails []ReportFailSummary      `json:"fails"`
	Empty []ReportFileBaseSummary  `json:"empty"`
	Dupes []ReportDuplicateSummary `json:"dupes"`
}

type ReportMeta added in v0.0.7

type ReportMeta struct {
	Timestamp time.Time `json:"timestamp"`
	Config    *Flags    `json:"config"`
	Version   string    `json:"version"`
	Commit    string    `json:"commit"`
	Host      string    `json:"host"`
	User      string    `json:"user"`
}

type ReportOutput added in v0.0.7

type ReportOutput struct {
	Meta     ReportMeta    `json:"_meta"`
	Analysis ReportFiles   `json:"analysis"`
	Summary  ReportSummary `json:"summary"`
}

type ReportSummary added in v0.0.7

type ReportSummary struct {
	TopFiles          []ReportTopFilesSummary `json:"top"`
	DuplicateFileSize uint64                  `json:"duplicateFileSize"`
	TotalFiles        int64                   `json:"totalFiles"`
	TotalFileErrors   int64                   `json:"totalFileFails"`
	ElapsedTime       int64                   `json:"elapsedTime"`
	UniqueFiles       int64                   `json:"uniqueFiles"`
	EmptyFiles        int64                   `json:"emptyFiles"`
	DuplicateFiles    int64                   `json:"duplicateFiles"`
}

type ReportTopFilesSummary added in v0.0.7

type ReportTopFilesSummary struct {
	Hash string `json:"hash"`
	Size uint64 `json:"size"`
}

type RunSummary

type RunSummary struct {
	DuplicateFileSizeF string
	ReportFilename     string
	TopFiles           []analysis.Item
	DuplicateFileSize  uint64
	TotalFiles         int64
	TotalFileErrors    int64
	ElapsedTime        int64
	UniqueFiles        int64
	EmptyFiles         int64
	DuplicateFiles     int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL