vfs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = pvfs.Default

Default is the default vfs suppose to be used in production. It is directly backed by the underlying operating system's file system.

View Source
var DefaultPebbleFS = NewPebbleFS(Default)

DefaultPebbleFS is the default vfs for pebble suppose to be used in production. It is backed by the underlying operating system's file system.

Functions

func Clean

func Clean(dir string) string

Clean is a wrapper for filepath.Clean.

func IsExist

func IsExist(err error) bool

IsExist returns a boolean value indicating whether the specified error is to indicate that a file or directory already exists.

func IsNotExist

func IsNotExist(err error) bool

IsNotExist returns a boolean value indicating whether the specified error is to indicate that a file or directory does not exist.

func NewPebbleFS

func NewPebbleFS(fs FS) pbvfs.FS

NewPebbleFS creates a new pebble/vfs.FS instance.

func ReportLeakedFD

func ReportLeakedFD(fs FS, t *testing.T)

ReportLeakedFD reports leaked file fds.

func TempDir

func TempDir() string

TempDir returns the directory use for storing temporary files.

Types

type FS

type FS = pvfs.FS

FS is a vfs type

func GetTestFS

func GetTestFS() FS

GetTestFS creates and returns a FS instance to be used in tests. A FS backed by memory is returned when the MEMFS environmental variable is set, or it returns a regular Default FS backed by underlying operating system's file system.

func NewMemFS

func NewMemFS() FS

NewMemFS returns a new memory based FS implementation that can be used in tests. You are not suppose to use this in production as nothing is persistently stored.

Ad a "strict" memory-backed FS implementation, in short changes after the last Sync() will be lost after ResetToSyncedState() is called. For more detailed descriptions on its behaviour, see https://github.com/cockroachdb/pebble/blob/master/vfs/vfs.go

type File

type File = pvfs.File

File is a vfs file type

type MemFS added in v0.2.0

type MemFS = pvfs.MemFS

MemFS is the in memory fs type

type PebbleFS

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

PebbleFS is a wrapper struct that implements the pebble/vfs.FS interface.

func (*PebbleFS) Create

func (p *PebbleFS) Create(name string) (pbvfs.File, error)

Create ...

func (*PebbleFS) GetFreeSpace

func (p *PebbleFS) GetFreeSpace(path string) (uint64, error)

GetFreeSpace ...

func (*PebbleFS) GetVFS

func (p *PebbleFS) GetVFS() FS

GetVFS returns the underlying pvfs.FS.

func (p *PebbleFS) Link(oldname, newname string) error

Link ...

func (*PebbleFS) List

func (p *PebbleFS) List(dir string) ([]string, error)

List ...

func (*PebbleFS) Lock

func (p *PebbleFS) Lock(name string) (io.Closer, error)

Lock ...

func (*PebbleFS) MkdirAll

func (p *PebbleFS) MkdirAll(dir string, perm os.FileMode) error

MkdirAll ...

func (*PebbleFS) Open

func (p *PebbleFS) Open(name string, opts ...pbvfs.OpenOption) (pbvfs.File, error)

Open ...

func (*PebbleFS) OpenDir

func (p *PebbleFS) OpenDir(name string) (pbvfs.File, error)

OpenDir ...

func (*PebbleFS) PathBase

func (p *PebbleFS) PathBase(path string) string

PathBase ...

func (*PebbleFS) PathDir

func (p *PebbleFS) PathDir(path string) string

PathDir ...

func (*PebbleFS) PathJoin

func (p *PebbleFS) PathJoin(elem ...string) string

PathJoin ...

func (*PebbleFS) Remove

func (p *PebbleFS) Remove(name string) error

Remove ...

func (*PebbleFS) RemoveAll

func (p *PebbleFS) RemoveAll(name string) error

RemoveAll ...

func (*PebbleFS) Rename

func (p *PebbleFS) Rename(oldname, newname string) error

Rename ...

func (*PebbleFS) ReuseForWrite

func (p *PebbleFS) ReuseForWrite(oldname, newname string) (pbvfs.File, error)

ReuseForWrite ...

func (*PebbleFS) Stat

func (p *PebbleFS) Stat(name string) (os.FileInfo, error)

Stat ...

Jump to

Keyboard shortcuts

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