Documentation ¶
Index ¶
- Variables
- func NewExcludingDecorator(delegate file.Resolver, excludeFn excludeFn) file.Resolver
- func NewFromRootedUnindexedDirectory(dir string, base string) file.WritableResolver
- func NewFromUnindexedDirectory(dir string) file.WritableResolver
- func NewFromUnindexedDirectoryFS(fs afero.Fs, dir string, base string) file.WritableResolver
- func NormalizeBaseDirectory(base string) (string, error)
- func NormalizeRootDirectory(root string) (string, error)
- type ChrootContext
- func (r ChrootContext) Base() string
- func (r *ChrootContext) ChangeDirectory(dir string) error
- func (r *ChrootContext) ChangeRoot(dir string) error
- func (r ChrootContext) Root() string
- func (r ChrootContext) ToChrootPath(nativePath string) string
- func (r ChrootContext) ToNativePath(chrootPath string) (string, error)
- type ContainerImageAllLayers
- func (r *ContainerImageAllLayers) AllLocations(ctx context.Context) <-chan file.Location
- func (r *ContainerImageAllLayers) FileContentsByLocation(location file.Location) (io.ReadCloser, error)
- func (r *ContainerImageAllLayers) FileMetadataByLocation(location file.Location) (file.Metadata, error)
- func (r *ContainerImageAllLayers) FilesByGlob(patterns ...string) ([]file.Location, error)
- func (r *ContainerImageAllLayers) FilesByMIMEType(types ...string) ([]file.Location, error)
- func (r *ContainerImageAllLayers) FilesByPath(paths ...string) ([]file.Location, error)
- func (r *ContainerImageAllLayers) HasPath(path string) bool
- func (r *ContainerImageAllLayers) RelativeFileByPath(location file.Location, path string) *file.Location
- type ContainerImageSquash
- func (r *ContainerImageSquash) AllLocations(ctx context.Context) <-chan file.Location
- func (r *ContainerImageSquash) FileContentsByLocation(location file.Location) (io.ReadCloser, error)
- func (r *ContainerImageSquash) FileMetadataByLocation(location file.Location) (file.Metadata, error)
- func (r *ContainerImageSquash) FilesByGlob(patterns ...string) ([]file.Location, error)
- func (r *ContainerImageSquash) FilesByMIMEType(types ...string) ([]file.Location, error)
- func (r *ContainerImageSquash) FilesByPath(paths ...string) ([]file.Location, error)
- func (r *ContainerImageSquash) HasPath(path string) bool
- func (r *ContainerImageSquash) RelativeFileByPath(_ file.Location, path string) *file.Location
- type Deferred
- func (d *Deferred) AllLocations(ctx context.Context) <-chan file.Location
- func (d *Deferred) FileContentsByLocation(location file.Location) (io.ReadCloser, error)
- func (d *Deferred) FileMetadataByLocation(location file.Location) (file.Metadata, error)
- func (d *Deferred) FilesByGlob(patterns ...string) ([]file.Location, error)
- func (d *Deferred) FilesByMIMEType(types ...string) ([]file.Location, error)
- func (d *Deferred) FilesByPath(paths ...string) ([]file.Location, error)
- func (d *Deferred) HasPath(s string) bool
- func (d *Deferred) RelativeFileByPath(location file.Location, path string) *file.Location
- type Directory
- func (r *Directory) AllLocations(ctx context.Context) <-chan file.Location
- func (r Directory) FileContentsByLocation(location file.Location) (io.ReadCloser, error)
- func (r *Directory) FileMetadataByLocation(location file.Location) (file.Metadata, error)
- func (r Directory) FilesByGlob(patterns ...string) ([]file.Location, error)
- func (r *Directory) FilesByMIMEType(types ...string) ([]file.Location, error)
- func (r Directory) FilesByPath(userPaths ...string) ([]file.Location, error)
- func (r *Directory) HasPath(userPath string) bool
- func (r *Directory) RelativeFileByPath(_ file.Location, path string) *file.Location
- func (r Directory) String() string
- type Empty
- func (e Empty) AllLocations(_ context.Context) <-chan file.Location
- func (e Empty) FileContentsByLocation(_ file.Location) (io.ReadCloser, error)
- func (e Empty) FileMetadataByLocation(_ file.Location) (file.Metadata, error)
- func (e Empty) FilesByGlob(_ ...string) ([]file.Location, error)
- func (e Empty) FilesByMIMEType(_ ...string) ([]file.Location, error)
- func (e Empty) FilesByPath(_ ...string) ([]file.Location, error)
- func (e Empty) HasPath(_ string) bool
- func (e Empty) RelativeFileByPath(_ file.Location, _ string) *file.Location
- func (e Empty) Write(_ file.Location, _ io.Reader) error
- type PathIndexVisitor
- type UnindexedDirectory
- func (u UnindexedDirectory) AllLocations(ctx context.Context) <-chan file.Location
- func (u UnindexedDirectory) FileContentsByLocation(location file.Location) (io.ReadCloser, error)
- func (u UnindexedDirectory) FileMetadataByLocation(_ file.Location) (file.Metadata, error)
- func (u UnindexedDirectory) FilesByGlob(patterns ...string) (out []file.Location, _ error)
- func (u UnindexedDirectory) FilesByMIMEType(_ ...string) ([]file.Location, error)
- func (u UnindexedDirectory) FilesByPath(paths ...string) (out []file.Location, _ error)
- func (u UnindexedDirectory) HasPath(p string) bool
- func (u UnindexedDirectory) RelativeFileByPath(l file.Location, p string) *file.Location
- func (u UnindexedDirectory) Write(location file.Location, reader io.Reader) error
Constants ¶
This section is empty.
Variables ¶
var ErrSkipPath = errors.New("skip path")
Functions ¶
func NewExcludingDecorator ¶ added in v0.85.0
NewExcludingDecorator 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 NormalizeBaseDirectory ¶ added in v0.85.0
func NormalizeRootDirectory ¶ added in v0.85.0
Types ¶
type ChrootContext ¶ added in v0.85.0
type ChrootContext struct {
// contains filtered or unexported fields
}
ChrootContext helps to modify path from a real filesystem to a chroot-like filesystem, taking into account the user given root, the base path (if any) to consider as the root, and the current working directory. Note: this only works on a real filesystem, not on a virtual filesystem (such as a stereoscope filetree).
func NewChrootContext ¶ added in v0.85.0
func NewChrootContext(root, base, cwd string) (*ChrootContext, error)
func NewChrootContextFromCWD ¶ added in v0.85.0
func NewChrootContextFromCWD(root, base string) (*ChrootContext, error)
func (ChrootContext) Base ¶ added in v0.85.0
func (r ChrootContext) Base() string
Base returns the absolute base path with all symlinks evaluated.
func (*ChrootContext) ChangeDirectory ¶ added in v0.85.0
func (r *ChrootContext) ChangeDirectory(dir string) error
ChangeDirectory changes the current working directory so that any relative paths passed into ToNativePath() and ToChrootPath() honor the new CWD. If the process changes the CWD in-flight, this should be called again to ensure correct functionality of ToNativePath() and ToChrootPath().
func (*ChrootContext) ChangeRoot ¶ added in v0.85.0
func (r *ChrootContext) ChangeRoot(dir string) error
ChangeRoot swaps the path for the chroot.
func (ChrootContext) Root ¶ added in v0.85.0
func (r ChrootContext) Root() string
Root returns the root path with all symlinks evaluated.
func (ChrootContext) ToChrootPath ¶ added in v0.85.0
func (r ChrootContext) ToChrootPath(nativePath string) string
ToChrootPath takes a path from the underlying fs domain and converts it to a path that is relative to the current root context.
func (ChrootContext) ToNativePath ¶ added in v0.85.0
func (r ChrootContext) ToNativePath(chrootPath string) (string, error)
ToNativePath takes a path in the context of the chroot-like filesystem and converts it to a path in the underlying fs domain.
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(ctx context.Context) <-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 (*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(ctx context.Context) <-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 (*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 ¶
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 (*Deferred) AllLocations ¶
func (*Deferred) FileContentsByLocation ¶
func (*Deferred) FileMetadataByLocation ¶
func (*Deferred) FilesByGlob ¶
func (*Deferred) FilesByMIMEType ¶
func (*Deferred) FilesByPath ¶
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 (Directory) FileContentsByLocation ¶
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 (Directory) FilesByGlob ¶
FilesByGlob returns all file.References that match the given path glob pattern from any layer in the image.
func (*Directory) FilesByMIMEType ¶
func (Directory) FilesByPath ¶
FilesByPath returns all file.References that match the given paths from the directory.
func (*Directory) RelativeFileByPath ¶
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.
type Empty ¶
type Empty struct{}
func (Empty) FileContentsByLocation ¶
func (Empty) FileMetadataByLocation ¶
func (Empty) RelativeFileByPath ¶
type UnindexedDirectory ¶
type UnindexedDirectory struct {
// contains filtered or unexported fields
}
func (UnindexedDirectory) AllLocations ¶
func (u UnindexedDirectory) AllLocations(ctx context.Context) <-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 (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 ¶
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.