Skip to content

Commit d26ef61

Browse files
committed
lint fixes
Signed-off-by: Leonard Lyubich <[email protected]>
1 parent f192642 commit d26ef61

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

pkg/local_object_storage/metabase/metadata.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func invalidMetaBucketKeyErr(key []byte, cause error) error {
4646
return fmt.Errorf("invalid meta bucket key (prefix 0x%X): %w", key[0], cause)
4747
}
4848

49-
// TODO: fill on migration
50-
// TODO: ROOT and PHY props
51-
// TODO: cleaning on obj removal
49+
// TODO: fill on migration.
50+
// TODO: ROOT and PHY props.
51+
// TODO: cleaning on obj removal.
5252
func putMetadata(tx *bbolt.Tx, cnr cid.ID, id oid.ID, ver version.Version, owner user.ID, typ object.Type, creationEpoch uint64,
5353
payloadLen uint64, pldHash, pldHmmHash, splitID []byte, parentID, firstID oid.ID, attrs []object.Attribute) error {
5454
metaBkt, err := tx.CreateBucketIfNotExists(metaBucketKey(cnr))
@@ -651,7 +651,7 @@ func prepareMetaIDAttrKey(buf *keyBuffer, id oid.ID, attr string, valLen int) []
651651
k[0] = metaPrefixIDAttr
652652
off := 1 + copy(k[1:], id[:])
653653
off += copy(k[off:], attr)
654-
off += copy(k[off:], utf8Delimiter)
654+
copy(k[off:], utf8Delimiter)
655655
return k
656656
}
657657

pkg/local_object_storage/metabase/metadata_test.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func TestApplyFilter(t *testing.T) {
196196
check(anyData, anyData, true)
197197
check(anyData, anyData[:len(anyData)-1], true)
198198
check(anyData, append(anyData, 1), false)
199-
for i := range len(anyData) {
199+
for i := range anyData {
200200
check(anyData, anyData[:i], true)
201201
changed := slices.Concat(anyData[:i], []byte{anyData[i] + 1}, anyData[i+1:])
202202
check(anyData, changed[:i+1], false)
@@ -311,6 +311,7 @@ func TestIntBucketOrder(t *testing.T) {
311311
}
312312
return nil
313313
})
314+
require.NoError(t, err)
314315

315316
require.Equal(t, []string{
316317
"-115792089237316195423570985008687907853269984665640564039457584007913129639935",
@@ -1092,19 +1093,19 @@ func TestDB_SearchObjects(t *testing.T) {
10921093
}
10931094
heightSorted := []objectcore.SearchResultItem{
10941095
// attribute takes 1st order priority
1095-
{ids[9], []string{"0", otherAttrs[0]}},
1096-
{ids[8], []string{"1", otherAttrs[1]}},
1097-
{ids[7], []string{"50", otherAttrs[2]}},
1098-
{ids[6], []string{"100", otherAttrs[3]}},
1096+
{ID: ids[9], Attributes: []string{"0", otherAttrs[0]}},
1097+
{ID: ids[8], Attributes: []string{"1", otherAttrs[1]}},
1098+
{ID: ids[7], Attributes: []string{"50", otherAttrs[2]}},
1099+
{ID: ids[6], Attributes: []string{"100", otherAttrs[3]}},
10991100
// but if attribute equals, items are sorted by IDs. Secondary attributes have
11001101
// no effect, otherwise the order would not be reversed
1101-
{ids[3], []string{"101", otherAttrs[6]}},
1102-
{ids[4], []string{"101", otherAttrs[5]}},
1103-
{ids[5], []string{"101", otherAttrs[4]}},
1102+
{ID: ids[3], Attributes: []string{"101", otherAttrs[6]}},
1103+
{ID: ids[4], Attributes: []string{"101", otherAttrs[5]}},
1104+
{ID: ids[5], Attributes: []string{"101", otherAttrs[4]}},
11041105
// attribute takes power again
1105-
{ids[2], []string{"102", otherAttrs[7]}},
1106-
{ids[1], []string{"150", otherAttrs[8]}},
1107-
{ids[0], []string{"4294967295", otherAttrs[9]}},
1106+
{ID: ids[2], Attributes: []string{"102", otherAttrs[7]}},
1107+
{ID: ids[1], Attributes: []string{"150", otherAttrs[8]}},
1108+
{ID: ids[0], Attributes: []string{"4294967295", otherAttrs[9]}},
11081109
}
11091110
// store
11101111
cnr := cidtest.ID()
@@ -1164,9 +1165,9 @@ func TestDB_SearchObjects(t *testing.T) {
11641165
require.Empty(t, res[i].Attributes)
11651166
}
11661167
require.NotEmpty(t, cursor)
1168+
//nolint:staticcheck // drop with t.Skip
11671169
res, cursor, err = db.Search(cnr, fs, nil, cursor, 6)
11681170
require.NoError(t, err)
1169-
// TODO: issue
11701171
t.Skip("paging is broken when prim attribute is not requested, see also https://github.com/nspcc-dev/neofs-node/issues/3058#issuecomment-2553193094")
11711172
require.Len(t, res, 6)
11721173
for i := range 6 {
@@ -1240,6 +1241,7 @@ func TestDB_SearchObjects(t *testing.T) {
12401241
require.Empty(t, res[i].Attributes)
12411242
}
12421243
require.NotEmpty(t, cursor)
1244+
//nolint:staticcheck // drop with t.Skip
12431245
res, cursor, err = db.Search(cnr, fs, nil, cursor, 6)
12441246
require.NoError(t, err)
12451247
t.Skip("paging is broken when prim attribute is not requested, see also https://github.com/nspcc-dev/neofs-node/issues/3058#issuecomment-2553193094")
@@ -1331,15 +1333,15 @@ func TestDB_SearchObjects(t *testing.T) {
13311333
require.NoError(t, err)
13321334
require.Empty(t, cursor)
13331335
require.Equal(t, []objectcore.SearchResultItem{
1334-
{ids[0], []string{"cat1.jpg", "1738760790"}},
1336+
{ID: ids[0], Attributes: []string{"cat1.jpg", "1738760790"}},
13351337
}, res)
13361338
})
13371339
t.Run("multiple", func(t *testing.T) {
13381340
t.Run("both attributes", func(t *testing.T) {
13391341
fullRes := []objectcore.SearchResultItem{
1340-
{ids[1], []string{"cat2.jpg", "1738760792"}},
1341-
{ids[2], []string{"cat2.jpg", "1738760791"}},
1342-
{ids[3], []string{"cat2.jpg", "1738760793"}},
1342+
{ID: ids[1], Attributes: []string{"cat2.jpg", "1738760792"}},
1343+
{ID: ids[2], Attributes: []string{"cat2.jpg", "1738760791"}},
1344+
{ID: ids[3], Attributes: []string{"cat2.jpg", "1738760793"}},
13431345
}
13441346
var fs object.SearchFilters
13451347
fs.AddFilter(object.AttributeFilePath, "cat2.jpg", object.MatchStringEqual)

0 commit comments

Comments
 (0)