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

Commit 47c8b78

Browse files
authored
fix!: make peer store methods atomic (#368)
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
1 parent 64f863a commit 47c8b78

File tree

2 files changed

+48
-368
lines changed

2 files changed

+48
-368
lines changed

packages/interface-peer-store/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154
"dependencies": {
155155
"@libp2p/interface-peer-id": "^2.0.0",
156156
"@libp2p/interface-peer-info": "^1.0.0",
157-
"@libp2p/interface-record": "^2.0.0",
158157
"@libp2p/interfaces": "^3.0.0",
159158
"@multiformats/multiaddr": "^12.0.0"
160159
},

0 commit comments

Comments
 (0)