mirrorfs

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrMap

type ErrMap errors.ErrMap

func (ErrMap) Error

func (e ErrMap) Error() string

type FS

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

FS is a meta filesystem, that has a base filesystem for reading and writing and optional mirrors that are also written to and deleted from

func New

func New(base fs.FS, opts ...Option) (*FS, error)

New returns a new FS based on base. On default, the methods only return errors from the base filesystem. The mirroring errors are tracked and should be checked by calling MirrorErrs() directly after calling Write or Delete. However, if OptReturnMirrorErrs() is passed as an option, writing and deleting will also return errors from the mirroring. Errors from mirroring if not nil, can always by casted to an ErrMap, where the key is the name of the mirror fs and the value is the corresponding error.

func (*FS) Abs

func (f *FS) Abs(p path.Relative) path.Absolute

func (*FS) Delete

func (f *FS) Delete(p path.Relative, recursive bool) error

func (*FS) Exists

func (f *FS) Exists(p path.Relative) bool

func (*FS) MirrorErrs

func (f *FS) MirrorErrs() error

MirrorErrs report the errors only of mirroring

func (*FS) ModTime

func (f *FS) ModTime(p path.Relative) (time.Time, error)

func (*FS) Reader

func (f *FS) Reader(p path.Relative) (io.ReadCloser, error)

func (*FS) Size

func (f *FS) Size(p path.Relative) int64

func (*FS) Write

func (f *FS) Write(p path.Relative, rd io.ReadCloser, inbetween bool) error

type Option

type Option func(*FS) error

func OptMirror

func OptMirror(name string, fsys fs.FS) Option

func OptReturnMirrorErrs

func OptReturnMirrorErrs(name string, fsys fs.FS) Option

OptReturnMirrorErrs returns the mirror errors also directly for delete and write operations

Jump to

Keyboard shortcuts

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