Skip to content

Conversation

Arlodotexe
Copy link
Collaborator

Summary

Implementation of ipfs-shipyard/net-ipfs-core#53

This PR was prepared by checking Kubo version changelogs 0.9.0 through 0.37.0 for any mentioned changes related to pinning, then these findings were cross-referenced with our existing codebase to identify the changes needed.

The IPinApi and a few other APIs that touch pinning (add, dag import etc.) have been brought fully in line with the (as yet unreleased) Kubo 0.37.0:

  • Introduced an overload for IProgress/IAsyncEnumerable-based pin add progress reporting while preserving non-progress flow.
  • [breaking] Refactored IPinApi.ListPinsAsync. Return type Task<IEnumerable<Cid>> is now IAsyncEnumerable<PinListItem>, and a PinListOptions param was added containing name filters, recurse and stream options.
  • [breaking] Updated pin add to accept PinAddOptions (replaces the recursive boolean parameter).
    • Support named pins: added Name support (PinAddOptions/PinListItem) and optional name filter in PinListOptions.
  • In the HTTP library, we've replaced JObject token handling with typed records/DTOs.
  • We now respect Kubo defaults for DAG import (pin-roots default) and switch DAG export to POST.
  • Add remarks that unpinning does not delete blocks; GC reclaims storage.

Changes (core)

  • Pin API
    • New PinListOptions and PinListItem domain model (list streaming and filtering preserved at the core surface).
    • IPinApi.ListAsync(...) unified as IAsyncEnumerable; added overload with PinListOptions.
    • IPinApi.AddAsync(...) updated to take PinAddOptions (replaces the recursive boolean); added overload with IProgress<BlocksPinnedProgress>.
    • Named pins: PinAddOptions.Name; PinListItem.Name; PinListOptions.Name filter and Names toggle.
    • Documentation: RemoveAsync remarks clarify that unpinning does not delete blocks; GC required to reclaim.
  • DAG API
    • DagApi.ImportAsync(...): omit pin-roots when null so Kubo default applies (roots pinned by default).
    • Model: CarImportOutput with Root and optional Stats.
  • File add options
    • AddFileOptions: added PinName; minor docs/option clarifications. In downstream HTTP client wiring, fixed hash parameter formatting and corrected fscache flag mapping.

Tests

  • Pin list: streaming and non-streaming coverage.
  • Pin add: progress and non-progress coverage.
  • Named pins (when supported by daemon): list names and name filtering covered at the HTTP client layer.
  • DAG import/export (in http client):
    • Default pin roots respected, pin-roots=false does not pin; export/import roundtrip preserves root CID.

Compatibility / Notes

  • Kubo<=0.36.x lacks --pin-name; net-ipfs-core exposes property but behavior depends on daemon version.
  • Some Kubo versions may not emit a dag import root line when pin-roots=false; the client tolerates this by returning an empty object.
  • Breaking changes (core):
    • IPinApi.ListAsync(...) now returns IAsyncEnumerable<PinListItem> (previously returned a materialized collection of CIDs); also added ListAsync(PinListOptions).
    • IPinApi.AddAsync(...) signature changed to use PinAddOptions (replaces the recursive bool parameter).
  • Non-breaking additions:
    • New overload IPinApi.AddAsync(..., IProgress<BlocksPinnedProgress> progress, ...).
    • AddFileOptions.PinName is additive and forward-compatible (effect depends on daemon version).
    • New types: PinListOptions, PinListItem.
    • Flag alias parity for --name/-n is provided at the HTTP client layer; core exposes the filter option.

…+ isolated node

PinApi: replace overloads with AddAsync(path, PinAddOptions); map Recursive/Name to recursive and name query params
PinApi: implement ListAsync(PinType) mapping to type=direct|indirect|recursive|all (omitted for all)
FileSystemApi: honor AddFileOptions.Pin (pin=true/false) when adding files
Tests: Add_WithName, Add_WithName_NonRecursive, List_WithType_All
TestFixture: start fresh Kubo via bootstrapper on 11501/18080; bootstrap peers; teardown
…tAsync options overload; tests for progress and streaming
…n-name; tests for named pin integration with pin list
…ubo; add export/import test; fix dag import tests to use Root; test fixture uses temp for kubo bin + working dir fallback
@Arlodotexe Arlodotexe merged commit d22821c into main Aug 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant