dockerfs

package
v0.0.0-...-089ce19 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dockerfs defines a FS interface for accessing files in a Docker container.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Path     string
	Metadata tar.Header
	Contents []byte
}

File represents a file in a Docker container.

func (File) Close

func (File) Close() error

Close is a no-op.

func (File) Read

func (c File) Read(buf []byte) (int, error)

Read records the file's contents to the provided buffer.

func (File) Stat

func (c File) Stat() (fs.FileInfo, error)

Stat returns the file's FileInfo.

type FileInfo

type FileInfo struct {
	LinkTarget string
	// contains filtered or unexported fields
}

FileInfo implements fs.FileInfo.

func NewFileInfo

func NewFileInfo(name string, size int64, mode fs.FileMode, modTime time.Time, linkTarget string) FileInfo

NewFileInfo builds a new FileInfo.

func (FileInfo) IsDir

func (fi FileInfo) IsDir() bool

IsDir returns whether this corresponds to a directory.

func (FileInfo) ModTime

func (fi FileInfo) ModTime() time.Time

ModTime returns the last modification time.

func (FileInfo) Mode

func (fi FileInfo) Mode() fs.FileMode

Mode returns the FileMode.

func (FileInfo) Name

func (fi FileInfo) Name() string

Name returns the file name.

func (FileInfo) Size

func (fi FileInfo) Size() int64

Size returns the file size in bytes.

func (FileInfo) Sys

func (fi FileInfo) Sys() any

Sys returns the underlying filesystem metadata for the FileInfo.

type Filesystem

type Filesystem struct {
	Client    httpx.BasicClient
	Container string
}

Filesystem exposes files in a Docker container via a FS-compatible API. NOTE: Client accesses will not use Scheme or Host URI elements.

func (Filesystem) Open

func (c Filesystem) Open(path string) (*File, error)

Open returns a File from a Docker container.

func (Filesystem) OpenAndResolve

func (c Filesystem) OpenAndResolve(path string) (*File, error)

OpenAndResolve returns the file from the given container, resolving any symlinks encountered.

func (Filesystem) Resolve

func (c Filesystem) Resolve(f *File) (*File, error)

Resolve attempts to resolve the symlink of the provided file.

func (Filesystem) Stat

func (c Filesystem) Stat(path string) (*FileInfo, error)

Stat returns the FileInfo of a file from a Docker container.

func (Filesystem) WriteFile

func (c Filesystem) WriteFile(f *File) error

WriteFile writes the contents of the file back to the Docker container.

Jump to

Keyboard shortcuts

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