fslocal

package
v1.142.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// Dir is a path to local directory to work with.
	Dir string

	// MaxBytesPerSecond is the maximum bandwidth usage during backups or restores.
	MaxBytesPerSecond int

	UseTmpFiles bool
	// contains filtered or unexported fields
}

FS represents local filesystem.

Backups are made from local fs. Data is restored from backups to local fs.

func (*FS) CleanupTmpFiles added in v1.122.18

func (fs *FS) CleanupTmpFiles() error

CleanupTmpFiles removes leftover .tmp files from interrupted restores. On platforms without preallocation this is a no-op.

func (*FS) DeletePath

func (fs *FS) DeletePath(path string) (uint64, error)

DeletePath deletes the given path from fs and returns the size for the deleted file.

The path must be in canonical form, e.g. it must have `/` directory separators

func (*FS) FinalizeFile added in v1.122.18

func (fs *FS) FinalizeFile(p common.Part) error

FinalizeFile syncs the completed file to disk. On platforms with preallocation, it first renames the .tmp file to its final path.

func (*FS) Init added in v1.29.5

func (fs *FS) Init() error

Init initializes fs.

The returned fs must be stopped when no long needed with MustStop call.

func (*FS) ListParts

func (fs *FS) ListParts() ([]common.Part, error)

ListParts returns all the parts for fs.

func (*FS) MustStop added in v1.44.0

func (fs *FS) MustStop()

MustStop stops fs.

func (*FS) NewDirectWriteCloser added in v1.122.18

func (fs *FS) NewDirectWriteCloser(p common.Part) (io.WriteCloser, error)

NewDirectWriteCloser returns an io.WriteCloser that writes directly to the underlying file without buffering, enabling large IO sizes from the caller. On platforms with preallocation, writes go to a .tmp file that must be finalized with FinalizeFile.

func (*FS) NewReadCloser

func (fs *FS) NewReadCloser(p common.Part) (io.ReadCloser, error)

NewReadCloser returns io.ReadCloser for the given part p located in fs.

func (*FS) PreallocateFile added in v1.122.18

func (fs *FS) PreallocateFile(p common.Part) error

PreallocateFile pre-allocates disk space for the file being written.

func (*FS) RemoveEmptyDirs

func (fs *FS) RemoveEmptyDirs() error

RemoveEmptyDirs recursively removes all the empty directories in fs.

func (*FS) String

func (fs *FS) String() string

String returns user-readable representation for the fs.

Jump to

Keyboard shortcuts

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