filesystem

package
v0.0.0-...-2d4f0a5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAllClose

func ReadAllClose(rc io.ReadCloser) ([]byte, error)

Types

type Filesystem

type Filesystem interface {
	WalkDir(fn SimpleWalkDirFunc) (err error)               // Walk the full filesystem using the SimpleWalkDirFunc fn
	Open(path string) (readCloser io.ReadCloser, err error) // Read a specific file with a path from root of the filesystem
	GetConfig() (config v1.Config, ok bool)                 // Get a config of this filesystem in container image format (if it exists)
	GetIdentifier() string                                  // Identifier for this specific filesystem; can be used for logging
}

Filesystem interface is mainly used to interact with all types of possible data source (e.g. directories, docker images etc.); for images this represents a squashed layer

type PlainFilesystem

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

Simple plain filesystem that is constructed from the directory

func NewPlainFilesystem

func NewPlainFilesystem(rootPath string) PlainFilesystem

Get a new PlainFilesystem from rootPath

func (PlainFilesystem) GetConfig

func (plainFilesystem PlainFilesystem) GetConfig() (config v1.Config, ok bool)

A plain directory does not have filesystem, so we return an empty object and false

func (PlainFilesystem) GetIdentifier

func (plainFilesystem PlainFilesystem) GetIdentifier() string

Get a unique string for this PlainFilesystem; can be used for logging etc.

func (PlainFilesystem) Open

func (plainFilesystem PlainFilesystem) Open(path string) (io.ReadCloser, error)

Read a file from this filesystem; path should be relative to PlainFilesystem.rootPath

func (PlainFilesystem) WalkDir

func (plainFilesystem PlainFilesystem) WalkDir(fn SimpleWalkDirFunc) error

Walk the whole PlainFilesystem using fn

type SimpleWalkDirFunc

type SimpleWalkDirFunc func(path string) error

A simple interface for a function to walk directories

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳