Skip to content

chore(cbind): nim-ffi migration [8/9] — relay, peerstore, metrics (API parity)#2779

Merged
gmelodie merged 4 commits into
masterfrom
chore/cbind/ffi/08-relay-peerstore-metrics
Jul 15, 2026
Merged

chore(cbind): nim-ffi migration [8/9] — relay, peerstore, metrics (API parity)#2779
gmelodie merged 4 commits into
masterfrom
chore/cbind/ffi/08-relay-peerstore-metrics

Conversation

@gmelodie

@gmelodie gmelodie commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

nim-ffi cbind migration — PR train

  1. chore(cbind): nim-ffi migration [1/9] — deps + pinning scaffold #2772 — deps + pinning
  2. chore(cbind): nim-ffi migration [2/9] — new-library scaffold + CI #2773 — scaffold + CI
  3. chore(cbind): nim-ffi migration [3/9] — connectivity & identity #2774 — connectivity
  4. chore(cbind): nim-ffi migration [4/9] — streams & custom protocols (+ echo example) #2775 — streams (+ echo)
  5. chore(cbind): nim-ffi migration [5/9] — pubsub / gossipsub (+ gossipsub example) #2776 — pubsub (+ gossipsub)
  6. chore(cbind): nim-ffi migration [6/9] — kademlia + CID + crypto #2777 — kad + CID + crypto
  7. chore(cbind): nim-ffi migration [7/9] — service discovery + extended peer records #2778 — service discovery
  8. chore(cbind): nim-ffi migration [8/9] — relay, peerstore, metrics (API parity) #2779 — relay / peerstore / metrics ← this PR
  9. chore(cbind): nim-ffi migration [9/9] — flip to libp2p.nim, delete legacy cbind #2780 — flip + delete legacy

Part 8 of a 9-PR train that replaces the hand-rolled cbind/ C bindings with the generated nim-ffi codegen, landing it domain by domain so each PR stays reviewable and CI-green (build the FFI lib + generate bindings + build/run examples).

Targets chore/cbind/ffi/07-service-disco (stacked).

This PR adds

  • libp2pCircuitRelayReserve.
  • Peerstore: addPeer, deletePeer, getPeerInfo, getPeers, setPeerAddresses, setPeerProtocols.
  • libp2pCollectMetrics (OpenMetrics -> JSON).
  • After this PR the new library is at full parity with the legacy cbind API surface.

Review artifact: Header diff shows the relay/peerstore/metrics entry points — the last additions before the flip.

@codecov-commenter

codecov-commenter commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.22%. Comparing base (1ce12fb) to head (ea4c255).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2779      +/-   ##
==========================================
- Coverage   81.25%   81.22%   -0.04%     
==========================================
  Files         170      170              
  Lines       30741    30741              
  Branches       12       12              
==========================================
- Hits        24978    24968      -10     
- Misses       5763     5773      +10     

see 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmelodie gmelodie mentioned this pull request Jul 7, 2026
2 tasks
@gmelodie
gmelodie force-pushed the chore/cbind/ffi/07-service-disco branch 11 times, most recently from 1216f59 to d806b8e Compare July 14, 2026 18:22
@gmelodie
gmelodie force-pushed the chore/cbind/ffi/08-relay-peerstore-metrics branch from e09e4dd to ffaed94 Compare July 14, 2026 18:25
@gmelodie
gmelodie force-pushed the chore/cbind/ffi/07-service-disco branch from c45f199 to 3b5095b Compare July 14, 2026 18:31
Base automatically changed from chore/cbind/ffi/07-service-disco to master July 14, 2026 20:17
@richard-ramos
richard-ramos force-pushed the master branch 2 times, most recently from 0da0bce to ae39cbb Compare July 14, 2026 21:51
@gmelodie
gmelodie force-pushed the chore/cbind/ffi/08-relay-peerstore-metrics branch 2 times, most recently from 4c13c82 to ed42670 Compare July 15, 2026 13:22
@gmelodie
gmelodie force-pushed the chore/cbind/ffi/08-relay-peerstore-metrics branch from ed42670 to ed6df52 Compare July 15, 2026 13:27
@gmelodie
gmelodie marked this pull request as ready for review July 15, 2026 13:27
@gmelodie
gmelodie requested review from a team, richard-ramos and vladopajic July 15, 2026 13:27

@richard-ramos richard-ramos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timestamp.toMilliseconds() is not available in std/times for nim 2.2.4

@github-project-automation github-project-automation Bot moved this from new to In Progress in nim-libp2p Jul 15, 2026
@gmelodie
gmelodie force-pushed the chore/cbind/ffi/08-relay-peerstore-metrics branch from 5590d48 to ea4c255 Compare July 15, 2026 14:42
@gmelodie
gmelodie enabled auto-merge July 15, 2026 14:42
@gmelodie
gmelodie requested a review from richard-ramos July 15, 2026 14:42
@gmelodie
gmelodie added this pull request to the merge queue Jul 15, 2026
Merged via the queue into master with commit da61305 Jul 15, 2026
41 checks passed
@gmelodie
gmelodie deleted the chore/cbind/ffi/08-relay-peerstore-metrics branch July 15, 2026 16:06
@github-project-automation github-project-automation Bot moved this from In Progress to done in nim-libp2p Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

4 participants