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 ¶
- func Checksum(c rom.Checksum) func(*Synchronizer) error
- func DryRun(v bool) func(*Synchronizer) error
- func Logger(logger *log.Logger) func(*Synchronizer) error
- func Missing(r io.Reader) func(*Synchronizer) error
- func Workers(count int) func(*Synchronizer) error
- type DB
- type Synchronizer
- func (s *Synchronizer) Delete(dir string, datfile *dat.File) error
- func (s *Synchronizer) Reset()
- func (s *Synchronizer) Rx() uint64
- func (s *Synchronizer) Scan(dirs ...string) (*DB, error)
- func (s *Synchronizer) SetChecksum(c rom.Checksum) error
- func (s *Synchronizer) SetDryRun(v bool) error
- func (s *Synchronizer) SetLogger(logger *log.Logger) error
- func (s *Synchronizer) SetMissing(r io.Reader) error
- func (s *Synchronizer) SetWorkers(count int) error
- func (s *Synchronizer) Tx() uint64
- func (s *Synchronizer) Update(dir string, datfile *dat.File, db *DB) error
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