Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
chore: update go-libp2p v0.22.0
Browse files Browse the repository at this point in the history
This remove the github.com/libp2p/go-libp2p-loggables because AFAIT this is not usefull anymore (we use tracing now).

If people care about uuids in logs, we should log sessions in go-log instead.
  • Loading branch information
Jorropo committed Sep 1, 2022
1 parent 4e3736a commit 475c27c
Show file tree
Hide file tree
Showing 51 changed files with 362 additions and 1,033 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
submodules: recursive
- uses: actions/setup-go@v2
with:
go-version: "1.18.x"
go-version: "1.19.x"
- name: Run repo-specific setup
uses: ./.github/actions/go-check-setup
if: hashFiles('./.github/actions/go-check-setup') != ''
Expand All @@ -27,7 +27,7 @@ jobs:
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 # 2022.1 (v0.3.0)
run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3 # 2022.1.3 (v0.3.3)
- name: Check that go.mod is tidy
uses: protocol/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.17.x", "1.18.x" ]
go: [ "1.18.x", "1.19.x" ]
env:
COVERAGES: ""
runs-on: ${{ format('{0}-latest', matrix.os) }}
Expand Down
13 changes: 6 additions & 7 deletions benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"math"
"math/rand"
"os"
Expand All @@ -15,7 +14,7 @@ import (

"github.com/ipfs/go-bitswap/internal/testutil"
blocks "github.com/ipfs/go-block-format"
protocol "github.com/libp2p/go-libp2p-core/protocol"
protocol "github.com/libp2p/go-libp2p/core/protocol"

"github.com/ipfs/go-bitswap"
bsnet "github.com/ipfs/go-bitswap/network"
Expand Down Expand Up @@ -115,7 +114,7 @@ func BenchmarkFixedDelay(b *testing.B) {
}

out, _ := json.MarshalIndent(benchmarkLog, "", " ")
_ = ioutil.WriteFile("tmp/benchmark.json", out, 0666)
_ = os.WriteFile("tmp/benchmark.json", out, 0666)
printResults(benchmarkLog)
}

Expand Down Expand Up @@ -183,7 +182,7 @@ func BenchmarkFetchFromOldBitswap(b *testing.B) {
}

out, _ := json.MarshalIndent(benchmarkLog, "", " ")
_ = ioutil.WriteFile("tmp/benchmark.json", out, 0666)
_ = os.WriteFile("tmp/benchmark.json", out, 0666)
printResults(benchmarkLog)
}

Expand Down Expand Up @@ -241,7 +240,7 @@ func BenchmarkRealWorld(b *testing.B) {
subtestDistributeAndFetchRateLimited(b, 300, 200, slowNetworkDelay, slowBandwidthGenerator, stdBlockSize, bstoreLatency, allToAll, batchFetchAll)
})
out, _ := json.MarshalIndent(benchmarkLog, "", " ")
_ = ioutil.WriteFile("tmp/rw-benchmark.json", out, 0666)
_ = os.WriteFile("tmp/rw-benchmark.json", out, 0666)
printResults(benchmarkLog)
}

Expand All @@ -264,7 +263,7 @@ func BenchmarkDatacenter(b *testing.B) {
subtestDistributeAndFetchRateLimited(b, 3, 100, datacenterNetworkDelay, datacenterBandwidthGenerator, largeBlockSize, bstoreLatency, allToAll, unixfsFileFetch)
})
out, _ := json.MarshalIndent(benchmarkLog, "", " ")
_ = ioutil.WriteFile("tmp/rb-benchmark.json", out, 0666)
_ = os.WriteFile("tmp/rb-benchmark.json", out, 0666)
printResults(benchmarkLog)
}

Expand Down Expand Up @@ -305,7 +304,7 @@ func BenchmarkDatacenterMultiLeechMultiSeed(b *testing.B) {
})

out, _ := json.MarshalIndent(benchmarkLog, "", " ")
_ = ioutil.WriteFile("tmp/rb-benchmark.json", out, 0666)
_ = os.WriteFile("tmp/rb-benchmark.json", out, 0666)
printResults(benchmarkLog)
}

Expand Down
2 changes: 1 addition & 1 deletion bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
blockstore "github.com/ipfs/go-ipfs-blockstore"
exchange "github.com/ipfs/go-ipfs-exchange-interface"
logging "github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"

"go.uber.org/multierr"
)
Expand Down
4 changes: 2 additions & 2 deletions bitswap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
delay "github.com/ipfs/go-ipfs-delay"
mockrouting "github.com/ipfs/go-ipfs-routing/mock"
ipld "github.com/ipfs/go-ipld-format"
peer "github.com/libp2p/go-libp2p-core/peer"
p2ptestutil "github.com/libp2p/go-libp2p-netutil"
tu "github.com/libp2p/go-libp2p-testing/etc"
p2ptestutil "github.com/libp2p/go-libp2p-testing/netutil"
peer "github.com/libp2p/go-libp2p/core/peer"
)

func isCI() bool {
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"github.com/ipfs/go-metrics-interface"
process "github.com/jbenet/goprocess"
procctx "github.com/jbenet/goprocess/context"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
)

var log = logging.Logger("bitswap-client")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"

cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

// BlockPresenceManager keeps track of which peers have indicated that they
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/ipfs/go-bitswap/internal/testutil"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"

cid "github.com/ipfs/go-cid"
)
Expand Down
2 changes: 1 addition & 1 deletion client/internal/messagequeue/messagequeue.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
bsnet "github.com/ipfs/go-bitswap/network"
cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion client/internal/messagequeue/messagequeue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

bsmsg "github.com/ipfs/go-bitswap/message"
bsnet "github.com/ipfs/go-bitswap/network"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
)

Expand Down
2 changes: 1 addition & 1 deletion client/internal/peermanager/peermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/ipfs/go-metrics-interface"

cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

var log = logging.Logger("bs:peermgr")
Expand Down
2 changes: 1 addition & 1 deletion client/internal/peermanager/peermanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/ipfs/go-bitswap/internal/testutil"
cid "github.com/ipfs/go-cid"

"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
)

type msg struct {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/peermanager/peerwantmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

// Gauge can be used to keep track of a metric that increases and decreases
Expand Down
2 changes: 1 addition & 1 deletion client/internal/peermanager/peerwantmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/ipfs/go-bitswap/internal/testutil"
cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

type gauge struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

var log = logging.Logger("bitswap")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ipfs/go-bitswap/internal/testutil"

cid "github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
)

type fakeProviderNetwork struct {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/session/peerresponsetracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package session
import (
"math/rand"

peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

// peerResponseTracker keeps track of how many times each peer was the first
Expand Down
2 changes: 1 addition & 1 deletion client/internal/session/peerresponsetracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/ipfs/go-bitswap/internal/testutil"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

func TestPeerResponseTrackerInit(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/session/sentwantblockstracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package session

import (
cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

// sentWantBlocksTracker keeps track of which peers we've sent a want-block to
Expand Down
7 changes: 1 addition & 6 deletions client/internal/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import (
cid "github.com/ipfs/go-cid"
delay "github.com/ipfs/go-ipfs-delay"
logging "github.com/ipfs/go-log"
peer "github.com/libp2p/go-libp2p-core/peer"
loggables "github.com/libp2p/go-libp2p-loggables"
peer "github.com/libp2p/go-libp2p/core/peer"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -128,7 +127,6 @@ type Session struct {
periodicSearchDelay delay.D
// identifiers
notif notifications.PubSub
uuid logging.Loggable
id uint64

self peer.ID
Expand Down Expand Up @@ -164,7 +162,6 @@ func New(
incoming: make(chan op, 128),
latencyTrkr: latencyTracker{},
notif: notif,
uuid: loggables.Uuid("GetBlockRequest"),
baseTickDelay: time.Millisecond * 500,
id: id,
initialSearchDelay: initialSearchDelay,
Expand Down Expand Up @@ -242,8 +239,6 @@ func (s *Session) GetBlocks(ctx context.Context, keys []cid.Cid) (<-chan blocks.
ctx, span := internal.StartSpan(ctx, "Session.GetBlocks")
defer span.End()

ctx = logging.ContextWithLoggable(ctx, s.uuid)

return bsgetter.AsyncGetBlocks(ctx, s.ctx, keys, s.notif,
func(ctx context.Context, keys []cid.Cid) {
select {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
cid "github.com/ipfs/go-cid"
blocksutil "github.com/ipfs/go-ipfs-blocksutil"
delay "github.com/ipfs/go-ipfs-delay"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

type mockSessionMgr struct {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/session/sessionwantsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
bsbpm "github.com/ipfs/go-bitswap/client/internal/blockpresencemanager"

cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/internal/session/sessionwantsender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
bsspm "github.com/ipfs/go-bitswap/client/internal/sessionpeermanager"
"github.com/ipfs/go-bitswap/internal/testutil"
cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

type sentWants struct {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/sessionmanager/sessionmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
bssession "github.com/ipfs/go-bitswap/client/internal/session"
bssim "github.com/ipfs/go-bitswap/client/internal/sessioninterestmanager"
exchange "github.com/ipfs/go-ipfs-exchange-interface"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

// Session is a session that is managed by the session manager
Expand Down
2 changes: 1 addition & 1 deletion client/internal/sessionmanager/sessionmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

type fakeSession struct {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/sessionpeermanager/sessionpeermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

logging "github.com/ipfs/go-log"

peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

var log = logging.Logger("bs:sprmgr")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/ipfs/go-bitswap/internal/testutil"
peer "github.com/libp2p/go-libp2p-core/peer"
peer "github.com/libp2p/go-libp2p/core/peer"
)

type fakePeerTagger struct {
Expand Down
Loading

0 comments on commit 475c27c

Please sign in to comment.