Expand description
A Rust library to help interacting with cache directories and CACHEDIR.TAG files as defined
in Cache Directory Tagging Specification.
The abstract of the spefication should be more than enough to illustrate what we’re doing here:
Many applications create and manage directories containing cached information about content stored elsewhere, such as cached Web content or thumbnail-size versions of images or movies. For speed and storage efficiency we would often like to avoid backing up, archiving, or otherwise unnecessarily copying such directories around, but it is a pain to identify and individually exclude each such directory during data transfer operations. I propose an extremely simple convention by which applications can reliably “tag” any cache directories they create, for easy identification by backup systems and other data management utilities. Data management utilities can then heed or ignore these tags as the user sees fit.
Enums§
- TagState
- The state of a
CACHEDIR.TAGfile.
Constants§
- HEADER
- The
CACHEDIR.TAGfile header as defined by the specification.
Functions§
- add_tag
- Adds a tag to the specified
directory. - ensure_
tag - Ensures the tag exists in
directory. - get_
tag_ state - Gets the state of the tag in the specified directory.
- is_
tagged - Returns
trueif the tag is present atdirectory,falseotherwise. - mkdir_
atomic - Tries to create
directorywith aCACHEDIR.TAGfile atomically and returnstrueif it created it orfalseif the directory already exists, regardless of if theCACHEDIR.TAGfile exists in it or if it has the correct header.