Merge pull request #165 from libp2p/remove-deprecated-types

remove deprecated types
This commit is contained in:
Steven Allen 2021-07-22 12:43:35 -07:00 committed by GitHub
commit 3f599b0424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 85 deletions

View File

@ -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

View File

@ -5,7 +5,6 @@ import (
"time" "time"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
core "github.com/libp2p/go-libp2p-core/peerstore"
) )
// LatencyEWMASmooting governs the decay of the EWMA (the speed // LatencyEWMASmooting governs the decay of the EWMA (the speed
@ -13,9 +12,6 @@ import (
// 1 is 100% change, 0 is no change. // 1 is 100% change, 0 is no change.
var LatencyEWMASmoothing = 0.1 var LatencyEWMASmoothing = 0.1
// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.Metrics instead.
type Metrics = core.Metrics
type metrics struct { type metrics struct {
latmap map[peer.ID]time.Duration latmap map[peer.ID]time.Duration
latmu sync.RWMutex latmu sync.RWMutex

View File

@ -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)
}

View File

@ -19,19 +19,6 @@ type peerstore struct {
pstore.PeerMetadata 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) { func (ps *peerstore) Close() (err error) {
var errs []error var errs []error
weakClose := func(name string, c interface{}) { weakClose := func(name string, c interface{}) {