featurefmt

package
v2.0.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package featurefmt exposes functions to dynamically register methods for determining the features present in an image layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListFeatures

func ListFeatures(files tarutil.FilesMap) ([]database.FeatureVersion, error)

ListFeatures produces the list of FeatureVersions in an image layer using every registered Lister.

func LoadFileForTest

func LoadFileForTest(name string) []byte

LoadFileForTest can be used in order to obtain the []byte contents of a file that is meant to be used for test data.

func RegisterLister

func RegisterLister(name string, l Lister)

RegisterLister makes a Lister available by the provided name.

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

func RequiredFilenames

func RequiredFilenames() (files []string)

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

func TestLister

func TestLister(t *testing.T, l Lister, testData []TestData)

TestLister runs a Lister on each provided instance of TestData and asserts the ouput to be equal to the expected output.

Types

type Lister

type Lister interface {
	// ListFeatures produces a list of FeatureVersions present in an image layer.
	ListFeatures(tarutil.FilesMap) ([]database.FeatureVersion, error)

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

Lister represents an ability to list the features present in an image layer.

type TestData

type TestData struct {
	Files           tarutil.FilesMap
	FeatureVersions []database.FeatureVersion
}

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

Directories

Path Synopsis
Package apk implements a featurefmt.Lister for APK packages.
Package apk implements a featurefmt.Lister for APK packages.
Package dpkg implements a featurefmt.Lister for dpkg packages.
Package dpkg implements a featurefmt.Lister for dpkg packages.
Package rpm implements a featurefmt.Lister for rpm packages.
Package rpm implements a featurefmt.Lister for rpm packages.

Jump to

Keyboard shortcuts

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