mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2024-12-26 23:30:32 +08:00
Merge pull request #165 from libp2p/remove-deprecated-types
remove deprecated types
This commit is contained in:
commit
3f599b0424
46
interface.go
46
interface.go
@ -1,46 +0,0 @@
|
||||
package peerstore
|
||||
|
||||
import core "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ErrNotFound instead.
|
||||
var ErrNotFound = core.ErrNotFound
|
||||
|
||||
var (
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.AddressTTL instead.
|
||||
AddressTTL = core.AddressTTL
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.TempAddrTTL instead.
|
||||
TempAddrTTL = core.TempAddrTTL
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ProviderAddrTTL instead.
|
||||
ProviderAddrTTL = core.ProviderAddrTTL
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.RecentlyConnectedAddrTTL instead.
|
||||
RecentlyConnectedAddrTTL = core.RecentlyConnectedAddrTTL
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.OwnObservedAddrTTL instead.
|
||||
OwnObservedAddrTTL = core.OwnObservedAddrTTL
|
||||
)
|
||||
|
||||
const (
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.PermanentAddrTTL instead.
|
||||
PermanentAddrTTL = core.PermanentAddrTTL
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ConnectedAddrTTL instead.
|
||||
ConnectedAddrTTL = core.ConnectedAddrTTL
|
||||
)
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.Peerstore instead.
|
||||
type Peerstore = core.Peerstore
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.PeerMetadata instead.
|
||||
type PeerMetadata = core.PeerMetadata
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.AddrBook instead.
|
||||
type AddrBook = core.AddrBook
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.KeyBook instead.
|
||||
type KeyBook = core.KeyBook
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ProtoBook instead.
|
||||
type ProtoBook = core.ProtoBook
|
@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
core "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
)
|
||||
|
||||
// LatencyEWMASmooting governs the decay of the EWMA (the speed
|
||||
@ -13,9 +12,6 @@ import (
|
||||
// 1 is 100% change, 0 is no change.
|
||||
var LatencyEWMASmoothing = 0.1
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.Metrics instead.
|
||||
type Metrics = core.Metrics
|
||||
|
||||
type metrics struct {
|
||||
latmap map[peer.ID]time.Duration
|
||||
latmu sync.RWMutex
|
||||
|
22
peerinfo.go
22
peerinfo.go
@ -1,22 +0,0 @@
|
||||
package peerstore
|
||||
|
||||
import (
|
||||
core "github.com/libp2p/go-libp2p-core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peer.AddrInfo instead.
|
||||
type PeerInfo = core.AddrInfo
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peer.ErrInvalidAddr instead.
|
||||
var ErrInvalidAddr = core.ErrInvalidAddr
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peer.AddrInfoFromP2pAddr instead.
|
||||
func InfoFromP2pAddr(m ma.Multiaddr) (*core.AddrInfo, error) {
|
||||
return core.AddrInfoFromP2pAddr(m)
|
||||
}
|
||||
|
||||
// Deprecated: use github.com/libp2p/go-libp2p-core/peer.AddrInfoToP2pAddrs instead.
|
||||
func InfoToP2pAddrs(pi *core.AddrInfo) ([]ma.Multiaddr, error) {
|
||||
return core.AddrInfoToP2pAddrs(pi)
|
||||
}
|
13
peerstore.go
13
peerstore.go
@ -19,19 +19,6 @@ type peerstore struct {
|
||||
pstore.PeerMetadata
|
||||
}
|
||||
|
||||
// NewPeerstore creates a data structure that stores peer data, backed by the
|
||||
// supplied implementations of KeyBook, AddrBook and PeerMetadata.
|
||||
// Deprecated: use pstoreds.NewPeerstore or peerstoremem.NewPeerstore instead.
|
||||
func NewPeerstore(kb pstore.KeyBook, ab pstore.AddrBook, pb pstore.ProtoBook, md pstore.PeerMetadata) pstore.Peerstore {
|
||||
return &peerstore{
|
||||
KeyBook: kb,
|
||||
AddrBook: ab,
|
||||
ProtoBook: pb,
|
||||
PeerMetadata: md,
|
||||
Metrics: NewMetrics(),
|
||||
}
|
||||
}
|
||||
|
||||
func (ps *peerstore) Close() (err error) {
|
||||
var errs []error
|
||||
weakClose := func(name string, c interface{}) {
|
||||
|
Loading…
Reference in New Issue
Block a user