Skip to content

Commit

Permalink
fix: rename chunk count
Browse files Browse the repository at this point in the history
  • Loading branch information
martinconic committed Oct 9, 2024
1 parent 29ff1b9 commit 3368d11
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ components:
properties:
address:
type: string
chunkCount:
reserveSizeWithinRadius:
type: integer

StatusNeighborhoodsResponse:
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type statusResponse struct {
}

type statusNeighborhoodResponse struct {
Address string `json:"address"`
ChunkCount int `json:"chunkCount"`
Address string `json:"address"`
ReserveSizeWithinRadius int `json:"reserveSizeWithinRadius"`
}

type neighborhoodsResponse struct {
Expand Down Expand Up @@ -201,8 +201,8 @@ func (s *Service) statusGetNeighborhoods(w http.ResponseWriter, _ *http.Request)
binaryAddr += fmt.Sprintf("%08b ", b)
}
neighborhoods = append(neighborhoods, statusNeighborhoodResponse{
Address: binaryAddr,
ChunkCount: n.ChunkCount,
Address: binaryAddr,
ReserveSizeWithinRadius: n.ReserveSizeWithinRadius,
})
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/storer/reserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ func (db *DB) SubscribeBin(ctx context.Context, bin uint8, start uint64) (<-chan
}

type NeighborhoodStat struct {
Address swarm.Address
ChunkCount int
Address swarm.Address
ReserveSizeWithinRadius int
}

func (db *DB) NeighborhoodsStat(ctx context.Context) ([]*NeighborhoodStat, error) {
Expand All @@ -517,7 +517,7 @@ func (db *DB) NeighborhoodsStat(ctx context.Context) ([]*NeighborhoodStat, error
err := db.reserve.IterateChunksItems(0, func(ch *reserve.ChunkBinItem) (bool, error) {
for _, n := range neighs {
if swarm.Proximity(ch.Address.Bytes(), n.Address.Bytes()) >= networkRadius {
n.ChunkCount++
n.ReserveSizeWithinRadius++
break
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/storer/reserve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,8 @@ func TestNeighborhoodStats(t *testing.T) {
}

for _, n := range neighs {
if n.ChunkCount != chunkCountPerPO {
t.Fatalf("chunk count does not match. wanted %d, got %d", chunkCountPerPO, n.ChunkCount)
if n.ReserveSizeWithinRadius != chunkCountPerPO {
t.Fatalf("chunk count does not match. wanted %d, got %d", chunkCountPerPO, n.ReserveSizeWithinRadius)
}
}

Expand All @@ -735,7 +735,7 @@ func TestNeighborhoodStats(t *testing.T) {

t.Run("disk", func(t *testing.T) {
t.Parallel()
opts := dbTestOps(baseAddr, 10000, nil, nil, time.Minute)
opts := dbTestOps(baseAddr, 100000, nil, nil, time.Minute)
opts.ReserveCapacityDoubling = int(doublingFactor)
storer, err := diskStorer(t, opts)()
if err != nil {
Expand All @@ -746,7 +746,7 @@ func TestNeighborhoodStats(t *testing.T) {
})
t.Run("mem", func(t *testing.T) {
t.Parallel()
opts := dbTestOps(baseAddr, 10000, nil, nil, time.Minute)
opts := dbTestOps(baseAddr, 100000, nil, nil, time.Minute)
opts.ReserveCapacityDoubling = int(doublingFactor)
storer, err := memStorer(t, opts)()
if err != nil {
Expand Down

0 comments on commit 3368d11

Please sign in to comment.