scan

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2018 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrScanAborted is returned when a scan is aborted by the user
	ErrScanAborted = errors.New("scan aborted")
	// ErrScanInProgress is returned when a scan is started while another is already in progress
	ErrScanInProgress = errors.New("scan already in progress")
	// ErrNoSyncMethod is returned when no sync protocol is available
	ErrNoSyncMethod = errors.New("no suitable URL for the scan")
)
View Source
var (

	// ErrNoTrace is returned when no trace file is found
	ErrNoTrace = errors.New("No trace file")
)

Functions

func IsScanning

func IsScanning(conn redis.Conn, id int) (bool, error)

IsScanning returns true is a scan is already in progress for the given mirror

func Scan

func Scan(typ ScannerType, r *database.Redis, url string, id int, stop <-chan struct{}) error

Scan starts a scan of the given mirror

func ScanSource

func ScanSource(r *database.Redis, forceRehash bool, stop <-chan struct{}) (err error)

ScanSource starts a scan of the local repository

Types

type FTPScanner

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

FTPScanner is the implementation of an ftp scanner

func (*FTPScanner) Scan

func (f *FTPScanner) Scan(scanurl, identifier string, conn redis.Conn, stop <-chan struct{}) error

Scan starts an ftp scan of the given mirror

type RsyncScanner

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

RsyncScanner is the implementation of an rsync scanner

func (*RsyncScanner) Scan

func (r *RsyncScanner) Scan(rsyncURL, identifier string, conn redis.Conn, stop <-chan struct{}) error

Scan starts an rsync scan of the given mirror

type Scanner

type Scanner interface {
	Scan(url, identifier string, conn redis.Conn, stop <-chan struct{}) error
}

Scanner is the interface that all scanners must implement

type ScannerType

type ScannerType int8

ScannerType holds the type of scanner in use

const (
	// RSYNC represents an rsync scanner
	RSYNC ScannerType = iota
	// FTP represents an ftp scanner
	FTP
)

type Trace

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

Trace is the internal trace handler

func NewTraceHandler

func NewTraceHandler(redis *database.Redis, stop <-chan struct{}) *Trace

NewTraceHandler returns a new instance of the trace file handler. Trace files are used to compute the time offset between a mirror and the local repository.

func (*Trace) GetLastUpdate

func (t *Trace) GetLastUpdate(mirror mirrors.Mirror) error

GetLastUpdate connects in HTTP to the mirror to get the latest trace file and computes the offset of the mirror.

Jump to

Keyboard shortcuts

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