-
Notifications
You must be signed in to change notification settings - Fork 189
feat/945-persistent-storage-for-peerstore #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat/945-persistent-storage-for-peerstore #946
Conversation
@Winter-Soren : Great effort. Reviewing the PR. Re-ran the CI/CD pipeline today after updating the branch. Wish if you could resolve the CI/CD issues. |
…ithub.com/Winter-Soren/py-libp2p into feat/945-persistent-storage-for-peerstore
@Winter-Soren : HI Soham. Thank you for resolving the CI/CD issues. 1 CI/CD test is failing. We investigated it and documented it at #949 . @yashksaini-coder , @sumanjeet0012 and @acul71 are fixing it. We will soon have all the CI/CD tests passing. @Winter-Soren : Will re-run CI/CD pipeline once the issue is fixed today or in a couple of days. |
Can I get access for this to check and work, @seetadev @Winter-Soren |
Hey @yashksaini-coder, |
@Winter-Soren : Updated the branch and re-ran the CI/CD pipeline. There seems to be one test issue. Looking forward to collaborating with you and resolving it soon. |
@Winter-Soren : The CI/CD issue got resolved. Wonderful. @pacrob: Hi Paul. Wish to have your feedback on this PR. On the same note, wish to share that I will ask @Winter-Soren and @yashksaini-coder to include a comprehensive test suite and also add a newsfragment. |
I added some questions. In this case, I do think example usage would be important. Tests and a newsfragment are also needed here. |
Thanks @pacrob for the detailed review and helpful comments 🙏 @Winter-Soren — please take a look at these points and update the PR soon. The switch to Trio (instead of asyncio) is important for consistency with the rest of the lib, so let’s refactor accordingly. Also, make sure the PeerData fields (last_identified, ttl, and latmap) are properly handled so we don’t lose data integrity. Adding a couple of example usages, along with tests and a newsfragment, will round this out nicely and make it easier for others to build on your work. Once you’ve made the updates, tag me and @pacrob for a quick re-review — this is very close to merge-ready! 🚀 |
Hi @pacrob, thank you for the review. I’ve addressed your points: 1. Trio consistency
2. trio.from_thread usage
3. PeerData fields persistence
4. Examples, tests, and documentation
|
@Winter-Soren : Great to hear, Soham. Appreciate your efforts. @pacrob and I will review the changes and share feedback soon. Wish if you could also add a discussion page for this PR sharing more details on implementation, example and a small screencast. |
What was wrong?
Currently, py-libp2p only provides an in-memory peerstore implementation that loses all peer data (addresses, keys, metadata, protocols) when the process restarts. This limits the resilience and performance of py-libp2p nodes, especially for long-running applications that need to maintain peer information across restarts.
Issue #945
How was it fixed?
Implemented a datastore-agnostic persistent peer storage system following the same architectural pattern as go-libp2p's
pstoreds
package. The solution provides:Summary of approach
Core Components:
libp2p/peer/datastore/
): Pluggable interface supporting multiple backendslibp2p/peer/persistent_peerstore.py
): Full async implementation with memory cachinglibp2p/peer/persistent_peerstore_factory.py
): Convenient creation methodsSupported Backends:
To-Do
Cute Animal Picture