Function cacache::reflink_hash_sync

source ·
pub fn reflink_hash_sync<P, Q>(cache: P, sri: &Integrity, to: Q) -> Result<()>
where P: AsRef<Path>, Q: AsRef<Path>,
Expand description

Reflinks/clonefiles cache data by hash to a specified location.

Fails if the destination is on a different filesystem or if the filesystem does not support reflinks.

Currently, reflinks are known to work on APFS (macOS), XFS, btrfs, and ReFS (Windows DevDrive)

§Example

use async_std::prelude::*;
use async_attributes;

#[async_attributes::main]
async fn main() -> cacache::Result<()> {
    let sri = cacache::write_sync("./my-cache", "my-key", b"hello world")?;
    cacache::reflink_hash_sync("./my-cache", &sri, "./data.txt")?;
    Ok(())
}