detectors

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package detectors exposes functions to register and use container information extractors.

Package detectors exposes functions to register and use container information extractors.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrCouldNotFindLayer is returned when we could not download or open the layer file.
	ErrCouldNotFindLayer = cerrors.NewBadRequestError("could not find layer")
)

Functions

func DetectData added in v1.0.0

func DetectData(format, path string, headers map[string]string, toExtract []string, maxFileSize int64) (data map[string][]byte, err error)

DetectData finds the Data of the layer by using every registered DataDetector

func DetectFeatures added in v1.0.0

func DetectFeatures(data map[string][]byte) ([]database.FeatureVersion, error)

DetectFeatures detects a list of FeatureVersion using every registered FeaturesDetector.

func DetectNamespace added in v1.0.0

func DetectNamespace(data map[string][]byte) *database.Namespace

DetectNamespace finds the OS of the layer by using every registered NamespaceDetector.

func GetRequiredFilesFeatures added in v1.0.0

func GetRequiredFilesFeatures() (files []string)

GetRequiredFilesFeatures returns the list of files required for Detect for every registered FeaturesDetector, without leading /.

func GetRequiredFilesNamespace added in v1.0.0

func GetRequiredFilesNamespace() (files []string)

GetRequiredFilesNamespace returns the list of files required for DetectNamespace for every registered NamespaceDetector, without leading /.

func RegisterDataDetector added in v1.0.0

func RegisterDataDetector(name string, f DataDetector)

RegisterDataDetector provides a way to dynamically register an implementation of a DataDetector.

If RegisterDataDetector is called twice with the same name if DataDetector is nil, or if the name is blank, it panics.

func RegisterFeaturesDetector added in v1.0.0

func RegisterFeaturesDetector(name string, f FeaturesDetector)

RegisterFeaturesDetector makes a FeaturesDetector available for DetectFeatures.

func RegisterNamespaceDetector added in v1.0.0

func RegisterNamespaceDetector(name string, f NamespaceDetector)

RegisterNamespaceDetector provides a way to dynamically register an implementation of a NamespaceDetector.

If RegisterNamespaceDetector is called twice with the same name if NamespaceDetector is nil, or if the name is blank, it panics.

Types

type DataDetector added in v1.0.0

type DataDetector interface {
	//Support check if the input path and format are supported by the underling detector
	Supported(path string, format string) bool
	// Detect detects the required data from input path
	Detect(layerReader io.ReadCloser, toExtract []string, maxFileSize int64) (data map[string][]byte, err error)
}

The DataDetector interface defines a way to detect the required data from input path

type FeaturesDetector added in v1.0.0

type FeaturesDetector interface {
	// Detect detects a list of FeatureVersion from the input data.
	Detect(map[string][]byte) ([]database.FeatureVersion, error)
	// GetRequiredFiles returns the list of files required for Detect, without
	// leading /.
	GetRequiredFiles() []string
}

The FeaturesDetector interface defines a way to detect packages from input data.

type NamespaceDetector added in v1.0.0

type NamespaceDetector interface {
	// Detect detects a Namespace and its version from input data.
	Detect(map[string][]byte) *database.Namespace
	// GetRequiredFiles returns the list of files required for Detect, without
	// leading /.
	GetRequiredFiles() []string
}

The NamespaceDetector interface defines a way to detect a Namespace from input data. A namespace is usually made of an Operating System name and its version.

Directories

Path Synopsis
data
aci
rpm

Jump to

Keyboard shortcuts

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