doc(rm): document rm API functions

This commit is contained in:
Kat Marchán 2019-06-30 20:18:47 -07:00
parent 982f8ee51a
commit fa8759b92c
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
1 changed files with 6 additions and 0 deletions

View File

@ -8,14 +8,20 @@ use crate::content::rm;
use crate::errors::Error;
use crate::index;
/// Removes an individual index entry. The associated content will be left
/// intact.
pub fn entry<P: AsRef<Path>>(cache: P, key: &str) -> Result<(), Error> {
index::delete(cache.as_ref(), &key)
}
/// Removes an individual content entry. Any index entries pointing to this
/// content will become invalidated.
pub fn content<P: AsRef<Path>>(cache: P, sri: &Integrity) -> Result<(), Error> {
rm::rm(cache.as_ref(), &sri)
}
/// Removes entire contents of the cache, including temporary files, the entry
/// index, and all content data.
pub fn all<P: AsRef<Path>>(cache: P) -> Result<(), Error> {
for entry in cache.as_ref().read_dir()? {
if let Ok(entry) = entry {