Open aarshkshah1992 opened 4 years ago
Since https://github.com/libp2p/specs/issues/164 is closed now, I'm posting my concern here as well:
How large is all this peer-related information? If the amount of data per peer is small, and even for hundreds of peers it is still in the order of megabytes, maybe a simpler cleanup approach could suffice? Like cleaning up less recently used peer information once in a while, instead of trying to do it in a more real-time fashion?
So, the question is, is it really necessary to constantly trying to purge the address book, creating a lot of writes and potentially saturating the datastore? If peer data is small enough, and there's not a lot of churn of peers, maybe it's worth keeping the peer data for longer?
See https://github.com/libp2p/specs/issues/164 for a great writeup on why we want to do this.
Rather than callers listening to Network events/notifications & changing the state of the data(addresses, keys, supported protocols etc.) in the peerstore via it's API, the peerstore itself should listen to events such as
Connected
,Disconnected
,Identify Completed
etc. on the Eventbus & mutate it's internal data accordingly.https://github.com/libp2p/go-libp2p/issues/801 should be completed before this.