driver

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2016 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package driver contains a Driver implementation that sends analyses to a CompilationAnalyzer based on a Queue of compilations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompilationFunc

type CompilationFunc func(context.Context, *apb.CompilationUnit) error

CompilationFunc handles a single CompilationUnit.

type Driver

type Driver struct {
	Analyzer        analysis.CompilationAnalyzer
	FileDataService string

	// AnalysisError is called for each non-nil err returned from the Analyzer
	// (before Teardown is called).  The error returned from AnalysisError
	// replaces the analysis error that would normally be returned from Run.
	AnalysisError func(context.Context, *apb.CompilationUnit, error) error

	// Compilations is a queue of compilations to be sent for analysis.
	Compilations Queue

	// Setup is called after a compilation has been pulled from the Queue and
	// before it is sent to the Analyzer (or Output is called).
	Setup CompilationFunc
	// Output is called for each analysis output returned from the Analyzer
	Output analysis.OutputFunc
	// Teardown is called after a compilation has been analyzed and there will be no further calls to Output.
	Teardown CompilationFunc
}

Driver sends compilations sequentially from a queue to an analyzer.

func (*Driver) Run

func (d *Driver) Run(ctx context.Context) error

Run sends each compilation received from the driver's Queue to the driver's Analyzer. All outputs are passed to Output in turn. An error is immediately returned if the Analyzer, Output, or Compilations fields are unset.

type Queue

type Queue interface {
	Next(context.Context, CompilationFunc) error
}

Queue is a generic interface to a sequence of CompilationUnits.

Jump to

Keyboard shortcuts

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