Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
fix!: make peer store methods atomic (#368)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
achingbrain authored Apr 21, 2023
1 parent 64f863a commit 47c8b78
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 368 deletions.
1 change: 0 additions & 1 deletion packages/interface-peer-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
"dependencies": {
"@libp2p/interface-peer-id": "^2.0.0",
"@libp2p/interface-peer-info": "^1.0.0",
"@libp2p/interface-record": "^2.0.0",
"@libp2p/interfaces": "^3.0.0",
"@multiformats/multiaddr": "^12.0.0"
},
Expand Down
Loading

0 comments on commit 47c8b78

Please sign in to comment.