synchronizer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package synchronizer implements a set of methods to maintain a pristine directory of TorrentZip files representing the games in a dat file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checksum

func Checksum(c rom.Checksum) func(*Synchronizer) error

Checksum configures the checksum algorithm used

func DryRun

func DryRun(v bool) func(*Synchronizer) error

DryRun configures whether changes are only logged

func Logger

func Logger(logger *log.Logger) func(*Synchronizer) error

Logger configures the logger used

func Missing

func Missing(r io.Reader) func(*Synchronizer) error

Missing reads from r a list of missing games

func Workers

func Workers(count int) func(*Synchronizer) error

Workers sets the numbers of workers used

Types

type DB

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

DB holds a collection of ROM checksums and the file(s) that provides them

type Synchronizer

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

Synchronizer encapsulates the configuration

func NewSynchronizer

func NewSynchronizer(options ...func(*Synchronizer) error) (*Synchronizer, error)

NewSynchronizer returns a new Synchronizer configured with any optional settings

func (*Synchronizer) Delete

func (s *Synchronizer) Delete(dir string, datfile *dat.File) error

Delete removes any file from dir that doesn't match a known game

func (*Synchronizer) Reset

func (s *Synchronizer) Reset()

Reset zeroes the bytes read & written counters

func (*Synchronizer) Rx

func (s *Synchronizer) Rx() uint64

Rx returns how many bytes have been read by s

func (*Synchronizer) Scan

func (s *Synchronizer) Scan(dirs ...string) (*DB, error)

Scan reads one or more directories and any archives within and stores the checksum of every file using the chosen checksum algorithm

func (*Synchronizer) SetChecksum

func (s *Synchronizer) SetChecksum(c rom.Checksum) error

SetChecksum configures the checksum algorithm used by s

func (*Synchronizer) SetDryRun

func (s *Synchronizer) SetDryRun(v bool) error

SetDryRun configures whether changes are only logged by s

func (*Synchronizer) SetLogger

func (s *Synchronizer) SetLogger(logger *log.Logger) error

SetLogger configures the logger used by s

func (*Synchronizer) SetMissing

func (s *Synchronizer) SetMissing(r io.Reader) error

SetMissing reads from r a list of missing games

func (*Synchronizer) SetWorkers

func (s *Synchronizer) SetWorkers(count int) error

SetWorkers sets the number of workers used by s

func (*Synchronizer) Tx

func (s *Synchronizer) Tx() uint64

Tx returns how many bytes have been written by s

func (*Synchronizer) Update

func (s *Synchronizer) Update(dir string, datfile *dat.File, db *DB) error

Update attempts to keep dir synchronized with the provided datfile using db to find any missing files based on the checksum value

Jump to

Keyboard shortcuts

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