model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package model defines the core data structures and types used throughout the doppel duplicate file finder.

This package provides:

  • DuplicateGroup: Represents a group of duplicate files with metadata
  • DuplicateReport: Contains the complete scan results and statistics
  • Stats: Thread-safe statistics tracking for the scanning process

All structures are designed to be serializable to JSON and YAML for output formatting, and the Stats type provides atomic operations for safe concurrent updates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateGroup

type DuplicateGroup struct {
	// ID is a unique identifier for the group.
	ID int `json:"ID" yaml:"ID"`

	// Count is the number of files in this group.
	Count int `json:"count" yaml:"count"`

	// Size is the size of each file in the group.
	Size int64 `json:"size" yaml:"size"`

	// WastedSpace is the total wasted space due to duplicates in this group.
	WastedSpace uint64 `json:"wasted_space" yaml:"wasted_space"`

	// Files contains the paths of the files in this group.
	Files []string `json:"files" yaml:"files"`
}

DuplicateGroup represents a group of duplicate files with their metadata.

type DuplicateReport

type DuplicateReport struct {
	// ScanDate is the date and time when the scan was performed.
	ScanDate time.Time `json:"scan_date" yaml:"scan_date"`

	// Stats contain various statistics about the scan.
	Stats *Stats `json:"stats" yaml:"stats"`

	// TotalWastedSpace is the total wasted space due to duplicates across all groups.
	TotalWastedSpace uint64 `json:"total_wasted_space" yaml:"total_wasted_space"`

	// Groups contain the list of duplicate file groups found.
	Groups []DuplicateGroup `json:"groups" yaml:"groups"`
}

DuplicateReport represents the report of duplicate files found during a scan.

type Stats

type Stats struct {
	// TotalFiles is the total number of files scanned.
	TotalFiles uint64 `json:"total_files" yaml:"total_files"`

	// ProcessedFiles is the number of files processed (not skipped).
	ProcessedFiles uint64 `json:"processed_files" yaml:"processed_files"`

	// SkippedDirs is the number of directories skipped due to filters.
	SkippedDirs uint64 `json:"skipped_dirs" yaml:"skipped_dirs"`

	// SkippedFiles is the number of files skipped due to filters.
	SkippedFiles uint64 `json:"skipped_files" yaml:"skipped_files"`

	// ErrorCount is the number of errors encountered during processing.
	ErrorCount uint64 `json:"error_count" yaml:"error_count"`

	// DuplicateGroups is the number of duplicate file groups found.
	DuplicateGroups uint64 `json:"duplicate_groups" yaml:"duplicate_groups"`

	// DuplicateFiles is the total number of files that are part of duplicate groups.
	DuplicateFiles uint64 `json:"duplicate_files" yaml:"duplicate_files"`

	// StartTime is the time when the scan started.
	StartTime time.Time `json:"start_time" yaml:"start_time"`

	// Duration is the total duration of the scan.
	Duration time.Duration `json:"duration" yaml:"duration"`
}

Stats track various statistics during the duplicate file finding process.

func (*Stats) AddDuplicateFiles

func (s *Stats) AddDuplicateFiles(count uint64)

AddDuplicateFiles atomically adds to the duplicate files count.

func (*Stats) GetDuplicateFiles

func (s *Stats) GetDuplicateFiles() uint64

GetDuplicateFiles atomically retrieves the duplicate files count.

func (*Stats) GetDuplicateGroups

func (s *Stats) GetDuplicateGroups() uint64

GetDuplicateGroups atomically retrieves the duplicate groups count.

func (*Stats) GetErrorCount

func (s *Stats) GetErrorCount() uint64

GetErrorCount atomically retrieves the error count.

func (*Stats) GetProcessedFiles

func (s *Stats) GetProcessedFiles() uint64

GetProcessedFiles atomically retrieves the processed files count.

func (*Stats) IncrementDuplicateGroups

func (s *Stats) IncrementDuplicateGroups()

IncrementDuplicateGroups atomically increments the duplicate groups count.

func (*Stats) IncrementErrorCount

func (s *Stats) IncrementErrorCount()

IncrementErrorCount atomically increments the error count.

func (*Stats) IncrementProcessedFiles

func (s *Stats) IncrementProcessedFiles()

IncrementProcessedFiles atomically increments the processed files count.

Jump to

Keyboard shortcuts

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