Skip to content
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
8b2979b
provider: adding provide and reprovide queue
guillaumemichel Jul 24, 2025
4049cfd
Merge branch 'provider' into provider-queues
guillaumemichel Jul 24, 2025
fac928e
provider: network operations
guillaumemichel Jul 24, 2025
87c3d14
add some tests
guillaumemichel Jul 24, 2025
7b681e5
schedule prefix len computations
guillaumemichel Jul 24, 2025
a191032
provider schedule
guillaumemichel Jul 24, 2025
41fcb41
provider: handleProvide
guillaumemichel Jul 24, 2025
4081f02
addressed review
guillaumemichel Aug 5, 2025
83e6f59
Merge branch 'provider' into provider-queues
guillaumemichel Aug 5, 2025
db73ea4
use go-test/random
guillaumemichel Aug 5, 2025
e0ece0a
satisfy linter
guillaumemichel Aug 5, 2025
039e0a4
Merge branch 'provider-queues' into provider-network-ops
guillaumemichel Aug 5, 2025
47f82bf
Merge branch 'provider' into provider-network-ops
guillaumemichel Aug 5, 2025
c707b63
Merge branch 'provider-network-ops' into provider-prefixlen
guillaumemichel Aug 5, 2025
fd95218
log errors during initial prefix len measurement
guillaumemichel Aug 5, 2025
b117913
Merge branch 'provider' into provider-prefixlen
guillaumemichel Aug 5, 2025
c8c4bc3
Merge branch 'provider-prefixlen' into provider-schedule
guillaumemichel Aug 5, 2025
fbe5f8a
address review
guillaumemichel Aug 5, 2025
e1ddf61
satisfy linter
guillaumemichel Aug 5, 2025
634601e
Merge branch 'provider-schedule' into provider-handleProvide
guillaumemichel Aug 5, 2025
834802b
address review
guillaumemichel Aug 5, 2025
5fa93f1
provider: explore swarm
guillaumemichel Aug 6, 2025
2889495
provider: batch provide
guillaumemichel Aug 6, 2025
47f65cb
provider: batch reprovide
guillaumemichel Aug 6, 2025
b9f9004
fix panic when adding key to trie if superstring already exists
guillaumemichel Aug 7, 2025
17335b6
address review
guillaumemichel Aug 8, 2025
31a1797
decrease minimal region size from replicationFactor+1 to replicationF…
guillaumemichel Aug 8, 2025
b64abe5
simplify unscheduleSubsumedPrefixesNoClock
guillaumemichel Aug 8, 2025
486a39c
Merge branch 'provider' into provider-prefixlen
guillaumemichel Aug 8, 2025
59c9e9a
Merge branch 'provider-prefixlen' into provider-schedule
guillaumemichel Aug 8, 2025
48a0033
Merge branch 'provider-schedule' into provider-handleProvide
guillaumemichel Aug 8, 2025
425565a
address review
guillaumemichel Aug 8, 2025
6900ec9
Merge branch 'provider-handleProvide' into provider-exploreSwarm
guillaumemichel Aug 8, 2025
1299170
Merge branch 'provider-exploreSwarm' into provider-batchProvide
guillaumemichel Aug 8, 2025
4111c0c
Merge branch 'provider-batchProvide' into provider-batchReprovide
guillaumemichel Aug 8, 2025
d318fae
fix test to match region size (now: replicationFactor, before: replic…
guillaumemichel Aug 8, 2025
79e38d9
Merge branch 'provider-exploreSwarm' into provider-batchProvide
guillaumemichel Aug 8, 2025
bbfba3d
Merge branch 'provider-batchProvide' into provider-batchReprovide
guillaumemichel Aug 8, 2025
c7f77e1
refactor and test groupAndScheduleKeysByPrefix
guillaumemichel Aug 8, 2025
1c13df6
Merge branch 'provider' into provider-schedule
guillaumemichel Aug 13, 2025
0e05081
moved maxPrefixSize const to top
guillaumemichel Aug 13, 2025
d0f030a
Merge branch 'provider-schedule' into provider-handleProvide
guillaumemichel Aug 13, 2025
b1f376e
Merge branch 'provider-handleProvide' into provider-exploreSwarm
guillaumemichel Aug 13, 2025
ab7b9e6
Merge branch 'provider-exploreSwarm' into provider-batchProvide
guillaumemichel Aug 13, 2025
933aace
Merge branch 'provider-schedule' into provider-handleProvide
guillaumemichel Aug 13, 2025
d09b224
Merge branch 'provider-handleProvide' into provider-exploreSwarm
guillaumemichel Aug 13, 2025
a69033a
Merge branch 'provider-exploreSwarm' into provider-batchProvide
guillaumemichel Aug 13, 2025
5919066
Merge branch 'provider' into provider-handleProvide
guillaumemichel Aug 13, 2025
553a92e
Merge branch 'provider-handleProvide' into provider-exploreSwarm
guillaumemichel Aug 13, 2025
f4d5789
Merge branch 'provider-exploreSwarm' into provider-batchProvide
guillaumemichel Aug 13, 2025
6e1c0c8
Merge branch 'provider' into provider-exploreSwarm
guillaumemichel Aug 13, 2025
1f91ac2
Merge branch 'provider-exploreSwarm' into provider-batchProvide
guillaumemichel Aug 13, 2025
71cb716
address review
guillaumemichel Aug 13, 2025
1b086a7
Merge branch 'provider' into provider-batchProvide
guillaumemichel Aug 13, 2025
056104c
Merge branch 'provider-batchProvide' into provider-batchReprovide
guillaumemichel Aug 13, 2025
8a3d816
Merge branch 'provider' into provider-batchReprovide
guillaumemichel Aug 13, 2025
cd338c8
address review
guillaumemichel Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/gammazero/deque v1.0.0
github.com/google/gopacket v1.1.19
github.com/google/uuid v1.6.0
github.com/guillaumemichel/reservedpool v0.1.0
github.com/hashicorp/golang-lru v1.0.2
github.com/ipfs/boxo v0.31.0
github.com/ipfs/go-cid v0.5.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
github.com/guillaumemichel/reservedpool v0.1.0 h1:QOG3bsExi+Erk2TBzGan87uqA48Ns27uhhnwgCJup+Y=
github.com/guillaumemichel/reservedpool v0.1.0/go.mod h1:sXSDIaef81TFdAJglsCFCMfgF5E5Z5xK1tFhjDhvbUc=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down
12 changes: 6 additions & 6 deletions provider/internal/keyspace/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ type Region struct {
Keys *trie.Trie[bit256.Key, mh.Multihash]
}

// RegionsFromPeers returns the keyspace regions of size `regionSize` from the
// given `peers` sorted according to `order` along with the Common Prefix
// shared by all peers.
// RegionsFromPeers returns the keyspace regions of size at least `regionSize`
// from the given `peers` sorted according to `order` along with the Common
// Prefix shared by all peers.
func RegionsFromPeers(peers []peer.ID, regionSize int, order bit256.Key) ([]Region, bitstr.Key) {
if len(peers) == 0 {
return []Region{}, ""
Expand All @@ -339,14 +339,14 @@ func RegionsFromPeers(peers []peer.ID, regionSize int, order bit256.Key) ([]Regi
}

// extractMinimalRegions returns the list of all non-overlapping subtries of
// `t` having strictly more than `size` elements, sorted according to `order`.
// Every element is included in exactly one region.
// `t` having at least `size` elements, sorted according to `order`. Every
// element is included in exactly one region.
func extractMinimalRegions(t *trie.Trie[bit256.Key, peer.ID], path bitstr.Key, size int, order bit256.Key) []Region {
if t.IsEmptyLeaf() {
return nil
}
branch0, branch1 := t.Branch(0), t.Branch(1)
if branch0 != nil && branch1 != nil && branch0.Size() > size && branch1.Size() > size {
if branch0 != nil && branch1 != nil && branch0.Size() >= size && branch1.Size() >= size {
b := int(order.Bit(len(path)))
return append(extractMinimalRegions(t.Branch(b), path+bitstr.Key(byte('0'+b)), size, order),
extractMinimalRegions(t.Branch(1-b), path+bitstr.Key(byte('1'-b)), size, order)...)
Expand Down
4 changes: 2 additions & 2 deletions provider/internal/keyspace/trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,15 @@ func TestRegionsFromPeers(t *testing.T) {

// Two peers
p1 := genRandPeerID(t)
regions, commonPrefix = RegionsFromPeers([]peer.ID{p0, p1}, 1, bit256.ZeroKey())
regions, commonPrefix = RegionsFromPeers([]peer.ID{p0, p1}, 2, bit256.ZeroKey())
require.Len(t, regions, 1)
cpl := key.CommonPrefixLength(bstrPid0, PeerIDToBit256(p1))
common := bstrPid0[:cpl]
require.Equal(t, common, commonPrefix)

// Three peers
p2 := genRandPeerID(t)
regions, commonPrefix = RegionsFromPeers([]peer.ID{p0, p1, p2}, 1, bit256.ZeroKey())
regions, commonPrefix = RegionsFromPeers([]peer.ID{p0, p1, p2}, 2, bit256.ZeroKey())
require.Len(t, regions, 1)
cpl = key.CommonPrefixLength(common, PeerIDToBit256(p2))
common = common[:cpl]
Expand Down
Loading
Loading