Skip to main content

Crate kache_fs

Crate kache_fs 

Source
Expand description

Portable file operations and allocation measurements.

Clone and copy helpers keep native filesystem calls behind one API. Measurements distinguish logical length, allocated bytes and private extents. Unknown private allocation stays None; directory totals carry a confidence level and account for hardlinks through an inode ledger. Callers own file placement, permissions policy and deletion decisions.

Structs§

CloneSketch
A bounded sample of the clone groups a directory’s files belong to.
DirSizing
Aggregate over a directory.
FileSizing
What one file costs, and what dies with it.
InodeId
Filesystem-unique file identity.
InodeLedger
ProbeCaps
What a platform probe can actually report.
VolumeUsage
Free and total bytes on the volume holding a path.

Enums§

Confidence
How much to trust an aggregate.
DirEntry
One entry of a directory as a probe reports it, already classified.
Sharing
How a file’s blocks are shared with other files.

Traits§

SizeProbe

Functions§

copy_writable
Copy bytes and set a writable destination mode (0644 or 0755 on Unix). On Windows this clears the destination’s read-only attribute. Like std::fs::copy, this can overwrite an existing destination. The caller must ensure that doing so cannot modify a file shared through a hardlink.
directory_identity
Identity of a directory. A symlink at the final component is rejected.
file_identity
Identity of the object at path, following symlinks. Valid for comparing live objects on this host; an inode can be reused after deletion.
handle_identity
Identity of the file an open handle refers to, whatever its path names now. Compared with file_identity it tells whether the path was unlinked or replaced after the handle was opened.
measure_file
Measure one file without running a separate capability probe first. Missing or unreadable files return an error; unavailable sharing information remains unknown in the returned measurement.
probe_for
Best probe for the filesystem holding path.
read_dir_one_by_one
The portable directory reader: names from read_dir, one probe per file.
set_writable_permissions
Set 0644 or 0755 on Unix; clear the read-only attribute on other platforms. This changes inode metadata and therefore also affects any hardlink aliases.
try_clone_extents_into
Share src data into an existing writable dst file.
try_reflink
Clone data into a new destination using the filesystem’s copy-on-write API. Existing destinations are never replaced. An unsupported filesystem returns an error so the caller can choose its fallback. This never creates a hardlink. Metadata follows the native clone operation; use set_writable_permissions when the destination needs a specified writable mode.
volume_usage
Volume usage for the filesystem holding path.