featurens

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package featurens exposes functions to dynamically register methods for determining a namespace for features present in an image layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(files tarutil.FilesMap) (*database.Namespace, error)

Detect iterators through all registered Detectors and returns the first non-nil detected namespace.

func RegisterDetector

func RegisterDetector(name string, d Detector)

RegisterDetector makes a detector available by the provided name.

If called twice with the same name, the name is blank, or if the provided Detector is nil, this function panics.

func RequiredFilenames

func RequiredFilenames() (files []string)

RequiredFilenames returns the total list of files required for all registered Detectors.

func TestDetector

func TestDetector(t *testing.T, d Detector, testData []TestData)

TestDetector runs a Detector on each provided instance of TestData and asserts the output to be equal to the expected output.

Types

type Detector

type Detector interface {
	// Detect attempts to determine a Namespace from a FilesMap of an image
	// layer.
	Detect(tarutil.FilesMap) (*database.Namespace, error)

	// RequiredFilenames returns the list of files required to be in the FilesMap
	// provided to the Detect method.
	//
	// Filenames must not begin with "/".
	RequiredFilenames() []string
}

Detector represents an ability to detect a namespace used for organizing features present in an image layer.

type TestData

type TestData struct {
	Files             tarutil.FilesMap
	ExpectedNamespace *database.Namespace
}

TestData represents the data used to test an implementation of Detector.

Directories

Path Synopsis
Package alpinerelease implements a featurens.Detector for Alpine Linux based container image layers.
Package alpinerelease implements a featurens.Detector for Alpine Linux based container image layers.
Package aptsources implements a featurens.Detector for apt based container image layers.
Package aptsources implements a featurens.Detector for apt based container image layers.
Package lsbrelease implements a featurens.Detector for container image layers containing an lsb-release file.
Package lsbrelease implements a featurens.Detector for container image layers containing an lsb-release file.
Package osrelease implements a featurens.Detector for container image layers containing an os-release file.
Package osrelease implements a featurens.Detector for container image layers containing an os-release file.
Package redhatrelease implements a featurens.Detector for container image layers containing an redhat-release-like files.
Package redhatrelease implements a featurens.Detector for container image layers containing an redhat-release-like files.

Jump to

Keyboard shortcuts

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