Documentation
¶
Overview ¶
Package osfs provides OS Filesystem access.
Index ¶
- Variables
- func HelperCmd() *subcommands.Command
- type FileSource
- type OSFS
- func (*OSFS) AsFileSource(ds digest.Source) (FileSource, bool)
- func (ofs *OSFS) Chmod(ctx context.Context, name string, mode fs.FileMode) error
- func (ofs *OSFS) Chtimes(ctx context.Context, name string, atime, mtime time.Time) error
- func (ofs *OSFS) FileDigestFromXattr(ctx context.Context, name string, size int64) (digest.Digest, error)
- func (ofs *OSFS) FileSource(name string, size int64) FileSource
- func (ofs *OSFS) Lstat(ctx context.Context, fname string) (fs.FileInfo, error)
- func (ofs *OSFS) MkdirAll(ctx context.Context, dirname string, perm fs.FileMode) error
- func (ofs *OSFS) Readlink(ctx context.Context, name string) (string, error)
- func (ofs *OSFS) Remove(ctx context.Context, name string) error
- func (ofs *OSFS) Rename(ctx context.Context, oldpath, newpath string) error
- func (ofs *OSFS) Symlink(ctx context.Context, oldname, newname string) error
- func (ofs *OSFS) WriteDigestData(ctx context.Context, name string, src digest.Source, perm fs.FileMode) error
- func (ofs *OSFS) WriteFile(ctx context.Context, name string, data []byte, perm fs.FileMode) error
- type Option
Constants ¶
This section is empty.
Variables ¶
var LstatSemaphore = semaphore.New("osfs-lstat", runtimex.NumCPU()*2)
LstatSemaphore is a semaphore to control concurrent lstat, to protect from thread exhaustion. b/365856347
Functions ¶
func HelperCmd ¶
func HelperCmd() *subcommands.Command
Types ¶
type FileSource ¶
type FileSource struct { Fname string // contains filtered or unexported fields }
FileSource is a file source.
func (FileSource) FileDigestFromXattr ¶
FileDigestFromXattr returns file's digest via xattr if possible.
func (FileSource) IsLocal ¶
func (FileSource) IsLocal()
IsLocal indicates FileSource is local file source.
func (FileSource) Open ¶
func (fsc FileSource) Open(ctx context.Context) (io.ReadCloser, error)
Open opens the named file for reading.
func (FileSource) String ¶
func (fsc FileSource) String() string
type OSFS ¶
OSFS provides OS Filesystem access. It counts metrics by iometrics. It would be an interface to communicate local filesystem server, in addition to local filesystem.
func (*OSFS) AsFileSource ¶
func (*OSFS) AsFileSource(ds digest.Source) (FileSource, bool)
AsFileSource asserts digest.Source value holds FileSource type, and return bool whether it holds or not.
func (*OSFS) FileDigestFromXattr ¶
func (ofs *OSFS) FileDigestFromXattr(ctx context.Context, name string, size int64) (digest.Digest, error)
FileDigestFromXattr returns file's digest via xattr if possible.
func (*OSFS) FileSource ¶
func (ofs *OSFS) FileSource(name string, size int64) FileSource
FileSource creates new FileSource for name. For FileDigestFromXattr, if size is non-negative, it will be used. If size is negative, it will check file info.