mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 19:44:01 +08:00

Turns out that `pool.Put(buf)` had to *allocate* because we needed to turn `[]byte` into `interface{}`. Apparently, we've never done this correctly we just never noticed because we never really used buffer pools extensively. However, since migrating yamux to a buffer-pool backed buffer, this started showing up in allocation profiles. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
27 lines
961 B
Go
27 lines
961 B
Go
package iface
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
|
|
|
pstore "gx/ipfs/QmWtCpWB39Rzc2xTB75MKorsxNpo3TyecTEN24CJ3KVohE/go-libp2p-peerstore"
|
|
peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer"
|
|
)
|
|
|
|
// DhtAPI specifies the interface to the DHT
|
|
// Note: This API will likely get deprecated in near future, see
|
|
// https://github.com/ipfs/interface-ipfs-core/issues/249 for more context.
|
|
type DhtAPI interface {
|
|
// FindPeer queries the DHT for all of the multiaddresses associated with a
|
|
// Peer ID
|
|
FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error)
|
|
|
|
// FindProviders finds peers in the DHT who can provide a specific value
|
|
// given a key.
|
|
FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error)
|
|
|
|
// Provide announces to the network that you are providing given values
|
|
Provide(context.Context, Path, ...options.DhtProvideOption) error
|
|
}
|