core

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLineAtomic

func AppendLineAtomic(path string, line string, perm os.FileMode) error

func ExpandTildePath

func ExpandTildePath(path string) (string, error)

func GetSortaDir

func GetSortaDir() (string, error)

func HumanReadable

func HumanReadable(n int64) string

func WriteFileAtomic

func WriteFileAtomic(path string, data []byte, perm os.FileMode) error

Types

type DuplicateStats

type DuplicateStats struct {
	FilesSeen      int
	PartialHashed  int
	FullHashed     int
	CacheHits      int
	CacheMisses    int
	BytesHashed    int64
	WalkDuration   time.Duration
	DecideDuration time.Duration
	TotalDuration  time.Duration
}

type FileEntry

type FileEntry struct {
	RootDir    string
	SourcePath string
	Size       int64
}

type FileOperation

type FileOperation struct {
	OpType     OperationType
	File       FileEntry
	DestPath   string
	Size       int64
	StagedPath string
}

type FileSystem

type FileSystem interface {
	Rename(oldpath, newpath string) error
	Remove(path string) error
	RemoveAll(path string) error
	MkdirAll(path string, perm os.FileMode) error
	Stat(name string) (os.FileInfo, error)
	ReadDir(name string) ([]os.DirEntry, error)
	IsNotExist(err error) bool
}

type OSFileSystem

type OSFileSystem struct{}

func (OSFileSystem) IsNotExist

func (OSFileSystem) IsNotExist(err error) bool

func (OSFileSystem) MkdirAll

func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error

func (OSFileSystem) ReadDir

func (OSFileSystem) ReadDir(name string) ([]os.DirEntry, error)

func (OSFileSystem) Remove

func (OSFileSystem) Remove(path string) error

func (OSFileSystem) RemoveAll

func (OSFileSystem) RemoveAll(path string) error

func (OSFileSystem) Rename

func (OSFileSystem) Rename(oldpath, newpath string) error

func (OSFileSystem) Stat

func (OSFileSystem) Stat(name string) (os.FileInfo, error)

type OperationType

type OperationType int
const (
	OpMove OperationType = iota
	OpRename
	OpDedupe
	OpDelete
	OpSkip
	OpUndo
)

type ProgressEvent

type ProgressEvent struct {
	Stage     string
	Completed int
	Total     int
}

type SortResult

type SortResult struct {
	Moved   int
	Renamed int
	Deduped int
	Skipped int
	Deleted int
	Errors  []error
}

func (*SortResult) PrintSummary

func (r *SortResult) PrintSummary()

type Sorter

type Sorter interface {
	Decide(ctx context.Context, filePaths []FileEntry) ([]FileOperation, error)
}

type Transaction

type Transaction struct {
	ID           string
	TType        TransactionType
	Operations   []FileOperation
	Irreversible bool
}

type TransactionType

type TransactionType int
const (
	TAction TransactionType = iota
	TUndo
)

Jump to

Keyboard shortcuts

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