fs

package
v0.0.0-...-f347108 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

Copyright 2023 Chainguard, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APKFS

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

func NewAPKFS

func NewAPKFS(ctx context.Context, archive string, apkfsType APKFSType) (*APKFS, error)

func (*APKFS) Close

func (a *APKFS) Close() error

func (*APKFS) Open

func (a *APKFS) Open(path string) (fs.File, error)

func (*APKFS) ReadDir

func (a *APKFS) ReadDir(path string) ([]fs.DirEntry, error)

func (*APKFS) Stat

func (a *APKFS) Stat(path string) (fs.FileInfo, error)

type APKFSType

type APKFSType int
const (
	APKFSControl APKFSType = iota
	APKFSPackage
)

type DirFSOption

type DirFSOption func(*dirFSOpts) error

DirFSOption is an option for DirFS

func DirFSWithCaseSensitive

func DirFSWithCaseSensitive(caseSensitive bool) DirFSOption

DirFSWithCaseSensitive allows you to specify whether the underlying filesystem should be treated as case-sensitive or insensitive. If you do not specify this, it determines it by testing the underlying filesystem. Normally you should let the filesystem determine this, but sometimes this can be useful.

func WithCreateDir

func WithCreateDir() DirFSOption

WithCreateDir allows you to specify whether the underlying directory should be created if it does not exist. Default is false.

type File

type File interface {
	fs.File
	io.WriteSeeker
	io.ReaderAt
}

File is an interface for a file. It includes Read, Write, Close. This wouldn't be necessary if os.File were an interface, or if fs.File were read/write.

type FullFS

type FullFS interface {
	Mkdir(path string, perm fs.FileMode) error
	MkdirAll(path string, perm fs.FileMode) error
	Open(name string) (fs.File, error)
	OpenReaderAt(name string) (File, error)
	OpenFile(name string, flag int, perm fs.FileMode) (File, error)
	ReadFile(name string) ([]byte, error)
	WriteFile(name string, b []byte, mode fs.FileMode) error
	ReadDir(name string) ([]fs.DirEntry, error)
	Mknod(path string, mode uint32, dev int) error
	Readnod(name string) (dev int, err error)
	Symlink(oldname, newname string) error
	Link(oldname, newname string) error
	Readlink(name string) (target string, err error)
	Stat(path string) (fs.FileInfo, error)
	Lstat(path string) (fs.FileInfo, error)
	Create(name string) (File, error)
	Remove(name string) error
	Chmod(path string, perm fs.FileMode) error
	Chown(path string, uid int, gid int) error
	SetXattr(path string, attr string, data []byte) error
	GetXattr(path string, attr string) ([]byte, error)
	RemoveXattr(path string, attr string) error
	ListXattrs(path string) (map[string][]byte, error)
}

FullFS is a filesystem that supports all filesystem operations.

func DirFS

func DirFS(dir string, opts ...DirFSOption) FullFS

func NewMemFS

func NewMemFS() FullFS

type OpenReaderAtFS

type OpenReaderAtFS interface {
	fs.FS
	OpenReaderAt(name string) (File, error)
}

type OpenReaderAtReadLinkFS

type OpenReaderAtReadLinkFS interface {
	OpenReaderAtFS
	ReadLinkFS
}

type OpenReaderAtReadLinkReadnodFS

type OpenReaderAtReadLinkReadnodFS interface {
	OpenReaderAtFS
	ReadLinkFS
	ReadnodFS
}

type ReadLinkFS

type ReadLinkFS interface {
	fs.FS
	Readlink(name string) (string, error)
}

type ReadnodFS

type ReadnodFS interface {
	fs.FS
	Readnod(name string) (dev int, err error)
}

type XattrFS

type XattrFS interface {
	fs.FS
	SetXattr(path string, attr string, data []byte) error
	GetXattr(path string, attr string) ([]byte, error)
	RemoveXattr(path string, attr string) error
	ListXattrs(path string) (map[string][]byte, error)
}

Jump to

Keyboard shortcuts

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