implhelper

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MEGA_BYTE = 1024 * 1024

Variables

View Source
var FileSizeThresholdInMB int64
View Source
var MaxGoRoutines int32

Functions

func AdjustCommonPrefix added in v0.4.0

func AdjustCommonPrefix(prefix string, s string) string

func GetCommonPrefix added in v0.4.0

func GetCommonPrefix(s1 string, s2 string) string

func GetFileCount

func GetFileCount(sourceDir string, searchRoot string, blackList []string, whiteList []string) int64

func GetFileSize added in v0.4.0

func GetFileSize(filePath string) (int64, error)

func GetMaxPathPrefixLen added in v0.4.0

func GetMaxPathPrefixLen(repo map[string]FileRepoEntry) int

func GetMaxTextLen added in v0.4.0

func GetMaxTextLen(repo map[string]FileRepoEntry) int

func GetMd5

func GetMd5(filePath string) (string, error)

func SearchForDuplicates

func SearchForDuplicates(searchRoot string, blackList []string, whiteList []string, fileRepo *FileRepo, doneChan chan<- *error, noProgress bool, ignoreSameFiles bool)

func TraversDir

func TraversDir(dir string, blackList []string, whiteList []string, foundChan chan<- TraversResponse, skipMd5 bool, ignoreSameFiles bool)

Types

type FileRepo

type FileRepo struct {
	// contains filtered or unexported fields
}

func NewFileRepo

func NewFileRepo() *FileRepo

func (*FileRepo) CheckForDuplicateAndAddInCase

func (f *FileRepo) CheckForDuplicateAndAddInCase(md5Str string, fileName string)

func (*FileRepo) GetEntry

func (f *FileRepo) GetEntry(md5Str string) (FileRepoEntry, bool)

func (*FileRepo) HasDuplicates

func (f *FileRepo) HasDuplicates() bool

func (*FileRepo) HasEntry

func (f *FileRepo) HasEntry(md5Str string) bool

func (*FileRepo) InitFromSource

func (f *FileRepo) InitFromSource(sourceDir string, blackList []string, whiteList []string, noProgress bool)

func (*FileRepo) Repo

func (f *FileRepo) Repo() map[string]FileRepoEntry

func (*FileRepo) SetEntry

func (f *FileRepo) SetEntry(md5Str string, fileName string)

func (*FileRepo) Size

func (f *FileRepo) Size() int

type FileRepoEntry

type FileRepoEntry struct {
	SourceFile string   `json:"sourceFile,omitempty"`
	Duplicates []string `json:"duplicates,omitempty"`
}

func NewFileRepoEntry

func NewFileRepoEntry(f string) FileRepoEntry

type TraversResponse

type TraversResponse struct {
	// contains filtered or unexported fields
}

func ErrorTraversResponse

func ErrorTraversResponse(err error) TraversResponse

func FoundTraversResponse

func FoundTraversResponse(file string, md5 string) TraversResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳