Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed May 27, 2024
1 parent 50e63d6 commit 49946c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
17 changes: 6 additions & 11 deletions share/shwap/namespace_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@ func NamespacedDataFromEDS(
return nil, fmt.Errorf("error computing root: %w", err)
}

rows := make(NamespacedData, 0, len(root.RowRoots))
for rowIdx, rowRoot := range root.RowRoots {
if namespace.IsOutsideRange(rowRoot, rowRoot) {
continue
}

shares := square.Row(uint(rowIdx))
rowData, err := RowNamespaceDataFromShares(shares, namespace, rowIdx)
rowIdxs := share.RowsWithNamespace(root, namespace)
rows := make(NamespacedData, len(rowIdxs))
for i, idx := range rowIdxs {
shares := square.Row(uint(idx))
rows[i], err = RowNamespaceDataFromShares(shares, namespace, idx)
if err != nil {
return nil, fmt.Errorf("failed to process row %d: %w", rowIdx, err)
return nil, fmt.Errorf("failed to process row %d: %w", idx, err)
}

rows = append(rows, rowData)
}

return rows, nil
Expand Down
6 changes: 3 additions & 3 deletions share/shwap/namespaced_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ func TestValidateNamespacedRow(t *testing.T) {
require.NoError(t, err)
require.True(t, len(nd) > 0)

rowIdx := share.RowsWithNamespace(root, namespace)
require.Len(t, nd, len(rowIdx))
rowIdxs := share.RowsWithNamespace(root, namespace)
require.Len(t, nd, len(rowIdxs))

for i, rowIdx := range rowIdx {
for i, rowIdx := range rowIdxs {
err = nd[i].Validate(root, namespace, rowIdx)
require.NoError(t, err)
}
Expand Down

0 comments on commit 49946c8

Please sign in to comment.