detectors

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 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

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

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

DetectFeatures detects a list of FeatureVersion using every registered FeaturesDetector.

func DetectNamespace

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

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

func GetRequiredFilesFeatures

func GetRequiredFilesFeatures() (files []string)

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

func GetRequiredFilesNamespace

func GetRequiredFilesNamespace() (files []string)

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

func RegisterDataDetector

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

func RegisterFeaturesDetector(name string, f FeaturesDetector)

RegisterFeaturesDetector makes a FeaturesDetector available for DetectFeatures.

func RegisterNamespaceDetector

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

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

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

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