snapshotcache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package snapshotcache disposes of staged restore files and evicts preserved snapshot files from the host page cache after an actor restore completes.

Index

Constants

This section is empty.

Variables

View Source
var (

	// RetryDelays are the backoff intervals between EvictWithRetries passes
	// while dirty pages wait for writeback.
	RetryDelays = []time.Duration{
		500 * time.Millisecond,
		1500 * time.Millisecond,
		3000 * time.Millisecond,
	}
)

Functions

func DropFile

func DropFile(t File) bool

DropFile unlinks t.Path if it still refers to the same inode and size, and reports whether the file was removed.

func DropFiles

func DropFiles(files []File) bool

DropFiles calls DropFile for each file in files and reports whether any file was removed.

func EvictFiles

func EvictFiles(targets []File) bool

EvictFiles evicts clean cached pages of targets via POSIX_FADV_DONTNEED and returns true if any target still has dirty or writeback pages remaining in cache (or if fadvise failed). Files with dirty or writeback pages are skipped so FADV_DONTNEED never forces synchronous disk writeback I/O.

func EvictWithRetries

func EvictWithRetries(targets []File)

EvictWithRetries runs EvictFiles immediately and, while pages remain in cache, retries after each interval in RetryDelays to evict pages once background kernel writeback cleans them.

func StartWriteback added in v1.0.0

func StartWriteback(paths []string, done func()) error

StartWriteback opens paths and, in the background, waits for each file's dirty pages to be written back or for the file to be unlinked, then calls done once. If a path can't be opened it returns the error, holds nothing, and never calls done.

Types

type File

type File struct {
	Path string
	Info fs.FileInfo
}

File identifies a snapshot data file pinned by its FileInfo at discovery time so delayed post-writeback passes cannot evict or unlink a newer file written at the same path.

func FindFiles

func FindFiles(dir string, match func(name string) bool) []File

FindFiles walks dir and returns regular files whose base name satisfies match, pinned by their FileInfo at discovery time.

Jump to

Keyboard shortcuts

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