Documentation
¶
Index ¶
- type FS
- func (fs *FS) CleanupTmpFiles() error
- func (fs *FS) DeletePath(path string) (uint64, error)
- func (fs *FS) FinalizeFile(p common.Part) error
- func (fs *FS) Init() error
- func (fs *FS) ListParts() ([]common.Part, error)
- func (fs *FS) MustStop()
- func (fs *FS) NewDirectWriteCloser(p common.Part) (io.WriteCloser, error)
- func (fs *FS) NewReadCloser(p common.Part) (io.ReadCloser, error)
- func (fs *FS) PreallocateFile(p common.Part) error
- func (fs *FS) RemoveEmptyDirs() error
- func (fs *FS) String() string
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
CleanupTmpFiles removes leftover .tmp files from interrupted restores. On platforms without preallocation this is a no-op.
func (*FS) DeletePath ¶
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
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
Init initializes fs.
The returned fs must be stopped when no long needed with MustStop call.
func (*FS) NewDirectWriteCloser ¶ added in v1.122.18
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 ¶
NewReadCloser returns io.ReadCloser for the given part p located in fs.
func (*FS) PreallocateFile ¶ added in v1.122.18
PreallocateFile pre-allocates disk space for the file being written.
func (*FS) RemoveEmptyDirs ¶
RemoveEmptyDirs recursively removes all the empty directories in fs.