Documentation
¶
Index ¶
Constants ¶
const SnapshotNameMaxLabel = 20
SnapshotNameMaxLabel caps the human-readable label in a staging dir name. The label is operator convenience only; uniqueness comes from the appended hash, not the label.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶ added in v1.38.3
CopyFile copies src to dst with an independent inode — unlike a hardlink, later writes to src can't corrupt dst. The destination is fsynced.
NOTE: not atomic (in-place write, no temp+rename), so a crash mid-copy can leave a partial dst. Does not create dst's parent directory.
func HardlinkFiles ¶ added in v1.38.3
func HardlinkFiles(pairs []HardlinkPair) error
HardlinkFiles hardlinks each pair, creating Dst's parent directories as needed.
The caller must keep the Src files stable for the call (e.g. by halting the shard) and pass only immutable files: a shared inode would let post-snapshot writes corrupt the staged copy. Use CopyFile for mutable files.
func ProbeHardlinkSupport ¶ added in v1.38.3
ProbeHardlinkSupport reports whether the filesystem backing dir supports hardlinks.
func SafeStagingDirName ¶ added in v1.38.3
SafeStagingDirName builds a staging directory name guaranteed to fit within filesystem path-component limits (255 bytes) regardless of input length, while staying unique via a hash suffix of the full input.
Example: SafeStagingDirName(".backup-staging-", "backup1", "myclass") → ".backup-staging-backup1-myclass-a1b2c3d4e5f6"
Types ¶
type FileMetadata ¶
type FileMetadata struct {
Name string `json:"name"`
Size int64 `json:"size"`
CRC32 uint32 `json:"crc32"`
}
func GetFileMetadata ¶
func GetFileMetadata(filePath string) (FileMetadata, error)
type HardlinkPair ¶ added in v1.38.3
HardlinkPair is one src→dst hardlink request; both are absolute paths.