libp2p / js-libp2p-interfaces

Contains test suites and interfaces you can use to implement the various components of js libp2p.
Other
75 stars 28 forks source link

fix!: make peer store methods atomic #368

Closed achingbrain closed 1 year ago

achingbrain commented 1 year ago

The existing peer store interface has separate sub-stores for addresses, protocols, metadata, etc.

Each method is async due to the underlying datastore being async.

This means it's impossible to do atomic writes to the peer store if you have multiple sets of data to write.

Internally, however, the default peer store implementation stores the peer data as a single datastore entry keyed on the peer id.

This PR:

  1. Removes the sub-stores in favour of atomic set/update methods for peer data
  2. Removes @libp2p/peer-store specific init types
  3. Removes tagging methods in favour of set/update for peer data
  4. Removes references to consuming peer records since this is part of the identify protocol so should be handled there
github-actions[bot] commented 1 year ago

:tada: This PR is included in version @libp2p/interface-peer-store-v2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: