issuewatcher

package
v2.5.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package issuewatcher wraps the issuefinder.Finder with some app-specific know-how in order to layer on top of the generic issuefinder to include behaviors necessary for finding issues from all known locations by reading our settings file and running the appropriate searches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

type Scanner struct {
	Finder              *issuefinder.Finder
	Webroot             string
	Tempdir             string
	ScanUpload          string
	PDFUpload           string
	PDFBatchMARCOrgCode string
	Lookup              *schema.Lookup
	CanonIssues         map[string]*schema.Issue
	// contains filtered or unexported fields
}

Scanner sets up all the necessary data to run issuefinders across all our standard locations. By default, a Scan() call won't do anything - one or more of the EnableXXX methods must first be called to set up paths.

func NewScanner

func NewScanner(conf *config.Config) *Scanner

NewScanner sets up the Scanner with no data

func (*Scanner) CacheFile

func (s *Scanner) CacheFile() string

CacheFile returns the standard path to the cache file based on the configuration of the watcher

func (*Scanner) Deserialize

func (s *Scanner) Deserialize() error

Deserialize attempts to read the CacheFile if it exists, populating the searchers and issue lookup

func (*Scanner) DisableDB

func (s *Scanner) DisableDB() *Scanner

DisableDB sets the flag to skip database searches

func (*Scanner) DisableSFTPUpload

func (s *Scanner) DisableSFTPUpload() *Scanner

DisableSFTPUpload sets the flag to skip sftp upload searches

func (*Scanner) DisableScannedUpload

func (s *Scanner) DisableScannedUpload() *Scanner

DisableScannedUpload sets the flag to skip scanned upload searches

func (*Scanner) DisableWeb

func (s *Scanner) DisableWeb() *Scanner

DisableWeb sets the flag to skip web searches

func (*Scanner) Duplicate

func (s *Scanner) Duplicate() *Scanner

Duplicate creates a new Scanner with the same configuration as this one, but with no data

func (*Scanner) LookupIssues

func (s *Scanner) LookupIssues(key *schema.Key) []*schema.Issue

LookupIssues returns a list of schema Issues for the give search key

func (*Scanner) Scan

func (s *Scanner) Scan() error

Scan calls all the individual find* functions for the myriad of ways we store issue information in the various locations (dependent on what's been enabled). The Scanner's issuefinder is replaced only after successful searching to ensure minimal disruption, especially in the event of an error.

func (*Scanner) Serialize

func (s *Scanner) Serialize() error

Serialize writes all internal search data to the CacheFile

type Watcher

type Watcher struct {
	sync.RWMutex
	Scanner *Scanner
	// contains filtered or unexported fields
}

A Watcher wraps the Scanner to provide a long-running issue watcher which scans issue directories and the live site at regular intervals

func New

func New(conf *config.Config) *Watcher

New creates an issue Watcher. Watch() must be called to begin looking for issues.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop signals the watch loop to stop running, allowing for cleanup to happen safely

func (*Watcher) Watch

func (w *Watcher) Watch(interval time.Duration)

Watch loops forever, refreshing the data in the underlying Finder every so often. The refreshing happens on a new issuefinder.Finder which then replaces the current finder data, preventing slow searches from holding up read access.

Jump to

Keyboard shortcuts

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