ferripfs-pinning 0.1.0

IPFS content pinning - prevent blocks from garbage collection
Documentation

ferripfs-pinning

IPFS content pinning - prevent blocks from being garbage collected.

Note: This crate is part of ferripfs, a Rust port of Kubo (the Go IPFS implementation). The implementation follows Kubo's boxo/pinning package. See Kubo's pinning documentation for conceptual details.

Features

  • Pin Types: Direct, Recursive, and Indirect pins
  • Named Pins: Associate names with pinned content
  • Pin Verification: Verify all pinned blocks exist
  • GC Protection: Pinned content survives garbage collection

Usage

use ferripfs_pinning::{BlockstorePinner, PinMode};

// Create a pinner
let pinner = BlockstorePinner::new("/path/to/repo")?;

// Add a recursive pin (pins block and all references)
pinner.pin_with_name(&cid, PinMode::Recursive, Some("my-data"))?;

// Add a direct pin (pins only the specified block)
pinner.pin_with_name(&cid, PinMode::Direct, None)?;

// List all pins
for pin in pinner.list_pins(None)? {
    println!("{}: {} ({})", pin.cid, pin.mode, pin.name.unwrap_or_default());
}

// Remove a pin
pinner.unpin(&cid)?;

// Verify all pins are intact
let results = pinner.verify()?;
for result in results {
    if !result.ok {
        println!("Missing block: {}", result.cid);
    }
}

Pin Types

Type Description
Direct Only the specified block is pinned
Recursive Block and all referenced blocks are pinned
Indirect Block is referenced by a recursive pin

License

Dual-licensed under MIT and Apache-2.0.