Documentation
¶
Index ¶
Constants ¶
const (
// DataFileName is the name of the core data file for an optimizer.
DataFileName = "rfo-data.json"
)
const ( // DefaultParallelLimit is the maximum number of concurrent goroutines that can be used for a // single operation. DefaultParallelLimit = 8 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileHash ¶
FileHash represents the hash of a single file.
func FileHashFromString ¶
FileHashFromString returns the FileHash for a given string.
type Optimizer ¶
type Optimizer struct {
// contains filtered or unexported fields
}
Optimizer optimizes the files in a given directory.
func NewOptimizer ¶
NewOptimizer returns a new Optimizer object initialized with the given options.
func (*Optimizer) Clone ¶ added in v0.6.3
Clone returns a new Optimizer with the same values as this optimizer.
func (*Optimizer) Copy ¶ added in v0.6.0
Copy copies this optimizer to a new path and returns a new corresponding optimizer. This is useful for situations where you want to use another drive as a buffer, etc.
func (*Optimizer) GetDataFilePath ¶ added in v0.3.0
GetDataFilePath returns the path to the data file.
type Option ¶
type Option func(*Optimizer)
Option represents an option that can used to configure a Optimizer.
func WithCacheDisabled ¶ added in v0.2.0
func WithCacheDisabled() Option
WithCacheDisabled disables caching when generating the file hash table.
func WithExcludes ¶
WithExcludes configures Regex patterns for files that should be explicitly excluded from the optimization. NOTE: This option conflicts with WithIncludes.
func WithIncludes ¶
WithIncludes configures Regex patterns for files that should be explicitly included in the optimization. If defined, all other files will be excluded. NOTE: This option conflicts with WithExcludes.
func WithLogger ¶ added in v0.3.0
WithLogger configures the optimizer to output to the given logger.
func WithParallelLimit ¶
WithParallelLimit can be used to configure the maximum number of parallel goroutines to use in any single operation.
type SharedFileMap ¶
SharedFileMap represents a mapping between shared file hashes and their corresponding file paths. This is necessary because the JSON package doesn't know how to handle slices with a fixed size.
func (SharedFileMap) MarshalJSON ¶
func (h SharedFileMap) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler.MarshalJSON(...) interface.
func (*SharedFileMap) UnmarshalJSON ¶
func (h *SharedFileMap) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Marshaler.UnmarshalJSON(...) interface.