Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeduplicateAll ¶ added in v0.0.12
func DeduplicateAll(archiveRoot string, duplicates [][]string, creator FileSystem) error
DeduplicateAll deduplicates all given files in the directory. This method actually executes the file operations if noDryRun is set.
Types ¶
type Algorithm ¶
type Algorithm struct {
// contains filtered or unexported fields
}
func NewAlgorithm ¶
NewAlgorithm returns a new Algorithm.
type DeDupTask ¶ added in v0.0.12
type DeDupTask struct { // ToKeep is the file path of the original to keep ToKeep string // ReCreateLinks are files which should be hard link to ToKeep. If they are already present, they should be deleted and recreated ReCreateLinks []string // DeleteFiles are files DeleteFiles []string }
func DeDuplicate ¶ added in v0.0.12
DeDuplicate files in the given archiveRoot. All files in duplicateFiles must start with the prefix archiveRoot. This function assumes the canonical archive layout: /archiveRoot/
/ YEAR / Month1 / Month2 / origin / dirOne / dirTwo
The file in DedupTask.ToKeep will be in the directory /YEAR/MONTH. If there are multiple files in the /YEAR/MONTH directories, the first file is kept. At most one file in every directory below /origin is kept.
type FileDeleter ¶ added in v0.0.12
type FileSystem ¶ added in v0.0.12
type FileSystem struct {
// contains filtered or unexported fields
}
func NewLoggingFileSystem ¶ added in v0.0.12
func NewLoggingFileSystem() FileSystem
func NewOSFileSystem ¶ added in v0.0.12
func NewOSFileSystem() FileSystem
func (FileSystem) CreateLinks ¶ added in v0.0.12
func (fs FileSystem) CreateLinks(paths []string, target string) error
createLinks create a symlink from every path in paths to the given target
func (FileSystem) EnsureAbsent ¶ added in v0.0.12
func (fs FileSystem) EnsureAbsent(name string) error
EnsureAbsent removes the given directory and returns an error if file is not deleted
func (FileSystem) EnsureDirectory ¶ added in v0.0.12
func (fs FileSystem) EnsureDirectory(name string) error
EnsureDirectory creates the directory recursive