mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-01-28 04:50:07 +08:00
fix: avoid copying locks/waitgroups
This commit is contained in:
parent
3b39a0abfa
commit
9aa80d7506
@ -52,10 +52,10 @@ func DefaultOpts() Options {
|
||||
type pstoreds struct {
|
||||
peerstore.Metrics
|
||||
|
||||
dsKeyBook
|
||||
dsAddrBook
|
||||
dsProtoBook
|
||||
dsPeerMetadata
|
||||
*dsKeyBook
|
||||
*dsAddrBook
|
||||
*dsProtoBook
|
||||
*dsPeerMetadata
|
||||
}
|
||||
|
||||
// NewPeerstore creates a peerstore backed by the provided persistent datastore.
|
||||
@ -79,10 +79,10 @@ func NewPeerstore(ctx context.Context, store ds.Batching, opts Options) (*pstore
|
||||
|
||||
ps := &pstoreds{
|
||||
Metrics: pstore.NewMetrics(),
|
||||
dsKeyBook: *keyBook,
|
||||
dsAddrBook: *addrBook,
|
||||
dsPeerMetadata: *peerMetadata,
|
||||
dsProtoBook: *protoBook,
|
||||
dsKeyBook: keyBook,
|
||||
dsAddrBook: addrBook,
|
||||
dsPeerMetadata: peerMetadata,
|
||||
dsProtoBook: protoBook,
|
||||
}
|
||||
return ps, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user