Documentation
¶
Overview ¶
Package hardlink provides filesystem hardlink detection utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAnyHardlinked ¶
IsAnyHardlinked returns true if at least one REGULAR file has link count > 1. Directories, symlinks, and non-regular files are skipped. Inaccessible files are skipped. Handles both relative paths (joined with basePath) and absolute paths.
func LinkInfo ¶
LinkInfo returns the unique file identifier and link count for a file. On Unix systems, fileID is composed of device ID and inode number. This enables hardlink accounting to distinguish between: - hardlinks within the torrent set (cross-seeds) - hardlinks outside the torrent set (arr imports)
Types ¶
type FileID ¶ added in v1.13.0
FileID uniquely identifies a physical file on disk. On Unix, this is the (device, inode) pair. This type is comparable and can be used as a map key without allocations.
func GetFileID ¶ added in v1.13.0
GetFileID returns the FileID and link count for a file without allocations. This is more efficient than LinkInfo when you don't need the string representation.
func (FileID) Bytes ¶ added in v1.13.0
Bytes returns a byte slice representation of the FileID for hashing. This is used for computing file signatures across platforms.
func (FileID) IsZero ¶ added in v1.13.0
IsZero returns true if the FileID is the zero value (uninitialized).
func (FileID) Less ¶ added in v1.13.0
Less returns true if this FileID is less than other. Used for sorting FileIDs.
func (FileID) WriteToHash ¶ added in v1.13.0
WriteToHash writes the FileID bytes directly to a hash.Hash. Uses a stack-allocated buffer to avoid heap escapes (unlike Bytes which returns a slice).