Skip to main content

sweep

Function sweep 

Source
pub async fn sweep(
    store: &dyn ObjectStore,
    prefix: &str,
    opts: SweepOpts,
) -> Result<SweepOutcome, PackchainError>
Expand description

Run the sweep phase: walk tombstones, delete eligible orphans.

prefix and the threading semantics match mark.

§Errors

Sweep is best-effort: a single tombstone failure does not abort the run (errors are logged and the next tombstone is tried). Returns PackchainError::Store only when the initial tombstone-list call fails.

§Example

use git_remote_object_store::Remote;
use git_remote_object_store::packchain::gc::{SweepOpts, sweep};

let remote = Remote::connect("s3+https://bucket/repo?engine=packchain").await?;
let outcome = sweep(
    remote.store(),
    remote.prefix(),
    SweepOpts::default(),
)
.await?;
println!(
    "swept {} tombstone(s), deleted {} object(s), deferred {}",
    outcome.swept_tombstones,
    outcome.deleted_objects,
    outcome.deferred_tombstones,
);