This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbackoffcache.go
32 lines (26 loc) · 1.67 KB
/
backoffcache.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package discovery
import (
"github.com/libp2p/go-libp2p-core/discovery"
dbackoff "github.com/libp2p/go-libp2p/p2p/discovery/backoff"
)
// BackoffDiscovery is an implementation of discovery that caches peer data and attenuates repeated queries
// Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffDiscovery instead.
type BackoffDiscovery = dbackoff.BackoffDiscovery
// Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffDiscoveryOption instead.
type BackoffDiscoveryOption = dbackoff.BackoffDiscoveryOption
// Deprecated: use go-libp2p/p2p/discovery/backoff.NewBackoffDiscovery instead.
func NewBackoffDiscovery(disc discovery.Discovery, stratFactory BackoffFactory, opts ...BackoffDiscoveryOption) (discovery.Discovery, error) {
return dbackoff.NewBackoffDiscovery(disc, stratFactory, opts...)
}
// WithBackoffDiscoverySimultaneousQueryBufferSize sets the buffer size for the channels between the main FindPeers query
// for a given namespace and all simultaneous FindPeers queries for the namespace
// Deprecated: use go-libp2p/p2p/discovery/backoff.WithBackoffDiscoverySimultaneousQueryBufferSize instead.
func WithBackoffDiscoverySimultaneousQueryBufferSize(size int) BackoffDiscoveryOption {
return dbackoff.WithBackoffDiscoverySimultaneousQueryBufferSize(size)
}
// WithBackoffDiscoveryReturnedChannelSize sets the size of the buffer to be used during a FindPeer query.
// Note: This does not apply if the query occurs during the backoff time
// Deprecated: use go-libp2p/p2p/discovery/backoff.WithBackoffDiscoveryReturnedChannelSize instead.
func WithBackoffDiscoveryReturnedChannelSize(size int) BackoffDiscoveryOption {
return dbackoff.WithBackoffDiscoveryReturnedChannelSize(size)
}