From 748231744626e5c2951ab07b22eb59a35696d663 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Thu, 22 Jul 2021 21:22:11 +0200 Subject: [PATCH] remove deprecated types --- interface.go | 46 ---------------------------------------------- metrics.go | 4 ---- peerinfo.go | 22 ---------------------- peerstore.go | 13 ------------- 4 files changed, 85 deletions(-) delete mode 100644 interface.go delete mode 100644 peerinfo.go diff --git a/interface.go b/interface.go deleted file mode 100644 index 105dedc..0000000 --- a/interface.go +++ /dev/null @@ -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 diff --git a/metrics.go b/metrics.go index 5edfbd4..3f916fb 100644 --- a/metrics.go +++ b/metrics.go @@ -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 diff --git a/peerinfo.go b/peerinfo.go deleted file mode 100644 index d414b82..0000000 --- a/peerinfo.go +++ /dev/null @@ -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) -} diff --git a/peerstore.go b/peerstore.go index 278a5f8..e168710 100644 --- a/peerstore.go +++ b/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{}) {