Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metabase: drop almost all of Prm/Res structures #3001

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

roman-khimov
Copy link
Member

They:

  • are present in some methods and not in others
  • add substantial cognitive overhead for anyone looking
  • require more code to handle trivial things
  • can allocate more and more of microobjects creating GC pressure

Test wrappers in the same package perfectly suggest what everyone wanted to have in the first place. So this patch is a pure refactoring and doesn't change any behavior, but it drops almost all structures. "Almost" because there are cases where we pass a number of things (mostly as a result) and having some enclosing structure makes some sense there.

They:
 * are present in some methods and not in others
 * add substantial cognitive overhead for anyone looking
 * require more code to handle trivial things
 * can allocate more and more of microobjects creating GC pressure

Test wrappers in the same package perfectly suggest what everyone wanted to
have in the first place. So this patch is a pure refactoring and doesn't
change any behavior, but it drops almost all structures. "Almost" because
there are cases where we pass a number of things (mostly as a result) and
having some enclosing structure makes some sense there.

Signed-off-by: Roman Khimov <[email protected]>
@roman-khimov roman-khimov added this to the v0.44.0 milestone Nov 6, 2024
@roman-khimov roman-khimov added enhancement Improving existing functionality U4 Nothing urgent S3 Minimally significant I4 No visible changes labels Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 63.19018% with 60 lines in your changes missing coverage. Please review.

Project coverage is 23.05%. Comparing base (2e583e5) to head (782005b).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
cmd/neofs-lens/internal/storage/sanity.go 0.00% 13 Missing ⚠️
cmd/neofs-lens/internal/meta/list-graveyard.go 0.00% 10 Missing ⚠️
pkg/local_object_storage/metabase/movable.go 53.33% 7 Missing ⚠️
cmd/neofs-lens/internal/meta/get.go 0.00% 4 Missing ⚠️
cmd/neofs-lens/internal/meta/list-garbage.go 0.00% 4 Missing ⚠️
pkg/local_object_storage/metabase/status.go 0.00% 3 Missing ⚠️
pkg/local_object_storage/metabase/storage_id.go 80.00% 3 Missing ⚠️
pkg/local_object_storage/shard/list.go 40.00% 3 Missing ⚠️
cmd/neofs-lens/internal/meta/list.go 0.00% 2 Missing ⚠️
pkg/local_object_storage/metabase/put.go 71.42% 2 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3001      +/-   ##
==========================================
- Coverage   23.15%   23.05%   -0.11%     
==========================================
  Files         789      789              
  Lines       58815    58669     -146     
==========================================
- Hits        13619    13526      -93     
+ Misses      44312    44262      -50     
+ Partials      884      881       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

prm.SetCount(vLimit)

res, err := db.ListWithCursor(prm)
addrs, _, err := db.ListWithCursor(int(vLimit), nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why int?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that's the type ListPrm had for count.

// Does not stop on an error if there are more objects to handle requested;
// returns the first error appeared with a number of deleted objects wrapped.
func (db *DB) Delete(prm DeletePrm) (DeleteRes, error) {
func (db *DB) Delete(addrs []oid.Address) (DeleteRes, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was variadic. not sure api has become better. but also does not claim it as a much worse one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see real users have arrays anyway, so this works fine.

}

// DoNotMove removes `MoveIt` mark from the object.
func (db *DB) DoNotMove(prm DoNotMovePrm) (res DoNotMoveRes, err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, i had no idea we had this method

@roman-khimov roman-khimov merged commit 619d638 into master Nov 7, 2024
21 of 22 checks passed
@roman-khimov roman-khimov deleted the drop-meta-prm-res branch November 7, 2024 05:57
roman-khimov added a commit that referenced this pull request Nov 12, 2024
Mostly similar to #3001, we have a number of Prm/Res structures that
make it harder to used engine and trace things going on. But there are
some functional changes here as well and also things that go beyond
Prm/Res. Overall we get rid of many pointless conversions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality I4 No visible changes S3 Minimally significant U4 Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants