processor

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CpProcessor

type CpProcessor struct {
	// SourceFile is the path of the file to be linked
	SourceFile string

	// DestFile is the path of the link to be created
	DestFile string

	// Storage is the storage interface to use
	Storage *storage.Storage

	// HashGen is the hash generator to use
	HashGen hash.Generator
}

CpProcessor is a processor that links a stored file to a destination. If the file is not already in storage, it is moved there and link the source to it before linking it to the destination

func NewCpProcessor

func NewCpProcessor(sourceFile, destFile string, storage *storage.Storage, hashGen hash.Generator) *CpProcessor

NewCpProcessor creates a new CpProcessor

func (*CpProcessor) Process

func (p *CpProcessor) Process(verbose bool) (err error)

Process processes the file and creates a link at the destination

type DedupProcessor

type DedupProcessor struct {
	// Source is the path of the directory to deduplicate
	Source string

	// DestDir is the path of the directory to copy deduplicated files to
	DestDir string

	// Storage is the storage interface to use
	Storage *storage.Storage

	// HashGen is the hash generator to use
	HashGen hash.Generator

	// Workers is the number of workers to use
	Workers int

	// FileMap is a map of original file paths to their hash in storage
	FileMap map[string]string
	// contains filtered or unexported fields
}

DedupProcessor is a processor that deduplicates files by moving them to a storage and creating a link to the original location

func NewDedupProcessor

func NewDedupProcessor(source, destDir string, storage *storage.Storage, hashGen hash.Generator, workers int) *DedupProcessor

NewDedupProcessor creates a new DedupProcessor

func (*DedupProcessor) Process

func (p *DedupProcessor) Process(verbose bool) error

Process processes the files in the source directory

type Processor

type Processor interface {
	Process(verbose bool) error
}

Processor defines the core processing logic, implement this to add new functionalities that can be orchestrated by DaBaDee

Jump to

Keyboard shortcuts

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