fileresolver

package
v0.83.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const WindowsOS = "windows"

Variables

View Source
var ErrSkipPath = errors.New("skip path")

Functions

func NewExcluding

func NewExcluding(delegate file.Resolver, excludeFn excludeFn) file.Resolver

NewExcluding create a new resolver which wraps the provided delegate and excludes entries based on a provided path exclusion function

func NewFromRootedUnindexedDirectory

func NewFromRootedUnindexedDirectory(dir string, base string) file.WritableResolver

func NewFromUnindexedDirectory

func NewFromUnindexedDirectory(dir string) file.WritableResolver

func NewFromUnindexedDirectoryFS

func NewFromUnindexedDirectoryFS(fs afero.Fs, dir string, base string) file.WritableResolver

Types

type ContainerImageAllLayers

type ContainerImageAllLayers struct {
	// contains filtered or unexported fields
}

ContainerImageAllLayers implements path and content access for the AllLayers source option for container image data sources.

func NewFromContainerImageAllLayers

func NewFromContainerImageAllLayers(img *image.Image) (*ContainerImageAllLayers, error)

NewFromContainerImageAllLayers returns a new resolver from the perspective of all image layers for the given image.

func (*ContainerImageAllLayers) AllLocations

func (r *ContainerImageAllLayers) AllLocations() <-chan file.Location

func (*ContainerImageAllLayers) FileContentsByLocation

func (r *ContainerImageAllLayers) FileContentsByLocation(location file.Location) (io.ReadCloser, error)

FileContentsByLocation fetches file contents for a single file reference, irregardless of the source layer. If the path does not exist an error is returned.

func (*ContainerImageAllLayers) FileMetadataByLocation

func (r *ContainerImageAllLayers) FileMetadataByLocation(location file.Location) (file.Metadata, error)

func (*ContainerImageAllLayers) FilesByGlob

func (r *ContainerImageAllLayers) FilesByGlob(patterns ...string) ([]file.Location, error)

FilesByGlob returns all file.References that match the given path glob pattern from any layer in the image. nolint:gocognit

func (*ContainerImageAllLayers) FilesByMIMEType

func (r *ContainerImageAllLayers) FilesByMIMEType(types ...string) ([]file.Location, error)

func (*ContainerImageAllLayers) FilesByPath

func (r *ContainerImageAllLayers) FilesByPath(paths ...string) ([]file.Location, error)

FilesByPath returns all file.References that match the given paths from any layer in the image.

func (*ContainerImageAllLayers) HasPath

func (r *ContainerImageAllLayers) HasPath(path string) bool

HasPath indicates if the given path exists in the underlying source.

func (*ContainerImageAllLayers) RelativeFileByPath

func (r *ContainerImageAllLayers) RelativeFileByPath(location file.Location, path string) *file.Location

RelativeFileByPath fetches a single file at the given path relative to the layer squash of the given reference. This is helpful when attempting to find a file that is in the same layer or lower as another file.

type ContainerImageSquash

type ContainerImageSquash struct {
	// contains filtered or unexported fields
}

ContainerImageSquash implements path and content access for the Squashed source option for container image data sources.

func NewFromContainerImageSquash

func NewFromContainerImageSquash(img *image.Image) (*ContainerImageSquash, error)

NewFromContainerImageSquash returns a new resolver from the perspective of the squashed representation for the given image.

func (*ContainerImageSquash) AllLocations

func (r *ContainerImageSquash) AllLocations() <-chan file.Location

func (*ContainerImageSquash) FileContentsByLocation

func (r *ContainerImageSquash) FileContentsByLocation(location file.Location) (io.ReadCloser, error)

FileContentsByLocation fetches file contents for a single file reference, regardless of the source layer. If the path does not exist an error is returned.

func (*ContainerImageSquash) FileMetadataByLocation

func (r *ContainerImageSquash) FileMetadataByLocation(location file.Location) (file.Metadata, error)

func (*ContainerImageSquash) FilesByGlob

func (r *ContainerImageSquash) FilesByGlob(patterns ...string) ([]file.Location, error)

FilesByGlob returns all file.References that match the given path glob pattern within the squashed representation of the image. nolint:gocognit

func (*ContainerImageSquash) FilesByMIMEType

func (r *ContainerImageSquash) FilesByMIMEType(types ...string) ([]file.Location, error)

func (*ContainerImageSquash) FilesByPath

func (r *ContainerImageSquash) FilesByPath(paths ...string) ([]file.Location, error)

FilesByPath returns all file.References that match the given paths within the squashed representation of the image.

func (*ContainerImageSquash) HasPath

func (r *ContainerImageSquash) HasPath(path string) bool

HasPath indicates if the given path exists in the underlying source.

func (*ContainerImageSquash) RelativeFileByPath

func (r *ContainerImageSquash) RelativeFileByPath(_ file.Location, path string) *file.Location

RelativeFileByPath fetches a single file at the given path relative to the layer squash of the given reference. This is helpful when attempting to find a file that is in the same layer or lower as another file. For the ContainerImageSquash, this is a simple path lookup.

type Deferred

type Deferred struct {
	// contains filtered or unexported fields
}

func NewDeferred

func NewDeferred(creator func() (file.Resolver, error)) *Deferred

func (*Deferred) AllLocations

func (d *Deferred) AllLocations() <-chan file.Location

func (*Deferred) FileContentsByLocation

func (d *Deferred) FileContentsByLocation(location file.Location) (io.ReadCloser, error)

func (*Deferred) FileMetadataByLocation

func (d *Deferred) FileMetadataByLocation(location file.Location) (file.Metadata, error)

func (*Deferred) FilesByGlob

func (d *Deferred) FilesByGlob(patterns ...string) ([]file.Location, error)

func (*Deferred) FilesByMIMEType

func (d *Deferred) FilesByMIMEType(types ...string) ([]file.Location, error)

func (*Deferred) FilesByPath

func (d *Deferred) FilesByPath(paths ...string) ([]file.Location, error)

func (*Deferred) HasPath

func (d *Deferred) HasPath(s string) bool

func (*Deferred) RelativeFileByPath

func (d *Deferred) RelativeFileByPath(location file.Location, path string) *file.Location

type Directory

type Directory struct {
	// contains filtered or unexported fields
}

Directory implements path and content access for the directory data source.

func NewFromDirectory

func NewFromDirectory(root string, base string, pathFilters ...PathIndexVisitor) (*Directory, error)

func (*Directory) AllLocations

func (r *Directory) AllLocations() <-chan file.Location

func (Directory) FileContentsByLocation

func (r Directory) FileContentsByLocation(location file.Location) (io.ReadCloser, error)

FileContentsByLocation fetches file contents for a single file reference relative to a directory. If the path does not exist an error is returned.

func (*Directory) FileMetadataByLocation

func (r *Directory) FileMetadataByLocation(location file.Location) (file.Metadata, error)

func (Directory) FilesByGlob

func (r Directory) FilesByGlob(patterns ...string) ([]file.Location, error)

FilesByGlob returns all file.References that match the given path glob pattern from any layer in the image.

func (*Directory) FilesByMIMEType

func (r *Directory) FilesByMIMEType(types ...string) ([]file.Location, error)

func (Directory) FilesByPath

func (r Directory) FilesByPath(userPaths ...string) ([]file.Location, error)

FilesByPath returns all file.References that match the given paths from the directory.

func (*Directory) HasPath

func (r *Directory) HasPath(userPath string) bool

HasPath indicates if the given path exists in the underlying source.

func (*Directory) RelativeFileByPath

func (r *Directory) RelativeFileByPath(_ file.Location, path string) *file.Location

RelativeFileByPath fetches a single file at the given path relative to the layer squash of the given reference. This is helpful when attempting to find a file that is in the same layer or lower as another file. For the Directory, this is a simple path lookup.

func (Directory) String

func (r Directory) String() string

Stringer to represent a directory path data source

type Empty

type Empty struct{}

func (Empty) AllLocations

func (e Empty) AllLocations() <-chan file.Location

func (Empty) FileContentsByLocation

func (e Empty) FileContentsByLocation(_ file.Location) (io.ReadCloser, error)

func (Empty) FileMetadataByLocation

func (e Empty) FileMetadataByLocation(_ file.Location) (file.Metadata, error)

func (Empty) FilesByGlob

func (e Empty) FilesByGlob(_ ...string) ([]file.Location, error)

func (Empty) FilesByMIMEType

func (e Empty) FilesByMIMEType(_ ...string) ([]file.Location, error)

func (Empty) FilesByPath

func (e Empty) FilesByPath(_ ...string) ([]file.Location, error)

func (Empty) HasPath

func (e Empty) HasPath(_ string) bool

func (Empty) RelativeFileByPath

func (e Empty) RelativeFileByPath(_ file.Location, _ string) *file.Location

func (Empty) Write

func (e Empty) Write(_ file.Location, _ io.Reader) error

type PathIndexVisitor

type PathIndexVisitor func(string, os.FileInfo, error) error

type UnindexedDirectory

type UnindexedDirectory struct {
	// contains filtered or unexported fields
}

func (UnindexedDirectory) AllLocations

func (u UnindexedDirectory) AllLocations() <-chan file.Location

- NO symlink resolution should be performed on results - returns locations for any file or directory

func (UnindexedDirectory) FileContentsByLocation

func (u UnindexedDirectory) FileContentsByLocation(location file.Location) (io.ReadCloser, error)

func (UnindexedDirectory) FileMetadataByLocation

func (u UnindexedDirectory) FileMetadataByLocation(_ file.Location) (file.Metadata, error)

func (UnindexedDirectory) FilesByGlob

func (u UnindexedDirectory) FilesByGlob(patterns ...string) (out []file.Location, _ error)

- full symlink resolution should be performed on all requests - if multiple paths to the same file are found, the best single match should be returned - only returns locations to files (NOT directories)

func (UnindexedDirectory) FilesByMIMEType

func (u UnindexedDirectory) FilesByMIMEType(_ ...string) ([]file.Location, error)

func (UnindexedDirectory) FilesByPath

func (u UnindexedDirectory) FilesByPath(paths ...string) (out []file.Location, _ error)

- full symlink resolution should be performed on all requests - only returns locations to files (NOT directories)

func (UnindexedDirectory) HasPath

func (u UnindexedDirectory) HasPath(p string) bool

- full symlink resolution should be performed on all requests - returns locations for any file or directory

func (UnindexedDirectory) RelativeFileByPath

func (u UnindexedDirectory) RelativeFileByPath(l file.Location, p string) *file.Location

RelativeFileByPath fetches a single file at the given path relative to the layer squash of the given reference. This is helpful when attempting to find a file that is in the same layer or lower as another file.

func (UnindexedDirectory) Write

func (u UnindexedDirectory) Write(location file.Location, reader io.Reader) error

Jump to

Keyboard shortcuts

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