Skip to content

engine: Support writing already encoded objects#2801

Merged
roman-khimov merged 2 commits intomasterfrom
feature/1723-engine-bin-write
Apr 12, 2024
Merged

engine: Support writing already encoded objects#2801
roman-khimov merged 2 commits intomasterfrom
feature/1723-engine-bin-write

Conversation

@cthulhu-rider
Copy link
Contributor

There is an object testing package itself which is usually imported as
`objecttest`.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@cthulhu-rider cthulhu-rider marked this pull request as draft April 5, 2024 10:54
Same as ffa8527 just for writing.

Refs #1723.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@cthulhu-rider cthulhu-rider force-pushed the feature/1723-engine-bin-write branch from 9a73762 to 9ddcbb3 Compare April 5, 2024 10:58
@codecov
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 22.17%. Comparing base (51fefac) to head (9ddcbb3).

Files Patch % Lines
pkg/local_object_storage/metabase/put.go 83.33% 1 Missing and 1 partial ⚠️
pkg/local_object_storage/shard/put.go 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2801      +/-   ##
==========================================
+ Coverage   22.13%   22.17%   +0.03%     
==========================================
  Files         793      793              
  Lines       47586    47607      +21     
==========================================
+ Hits        10533    10556      +23     
+ Misses      36148    36147       -1     
+ Partials      905      904       -1     

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

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Seems to be legit and can go into 0.41.0.

type PutPrm struct {
obj *objectSDK.Object

binSet bool
Copy link
Member

Choose a reason for hiding this comment

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

binSet == objBin != nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

binSet prevents duality b/w uncalled and called with nil cases

Copy link
Member

Choose a reason for hiding this comment

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

called with nil cases

is it valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

depends on the caller. This is his responsibility, docs say that

Copy link
Member

Choose a reason for hiding this comment

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

undesired complexity to me. calling with empty bytes ends with no error (i guess) while that is incorrect for sure

if err != nil {
return PutRes{}, fmt.Errorf("cannot marshal object: %w", err)
}
// TODO: currently, we don't need to calculate prm.hdrLen in this case.
Copy link
Member

Choose a reason for hiding this comment

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

todo with no issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this won't be lost

Copy link
Member

Choose a reason for hiding this comment

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

how can you be sure? we had a work once where the dev searched for such lost cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how can you be sure?

this is what git is made for

Copy link
Member

Choose a reason for hiding this comment

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

git is made for

searching for TODO strings? my point is that TODO is about smth that should be done. good to have a corresponding issue then. otherwise that is not TODO

Copy link
Member

Choose a reason for hiding this comment

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

To me it's not even a TODO, just a remark on the specifics of the current code. It's nothing actionable at this point.

@cthulhu-rider cthulhu-rider requested a review from carpawell April 11, 2024 06:08
}

// SetObjectBinary allows to provide the already encoded object in
// [StorageEngine] format. Object header must be a prefix with specified length.
Copy link
Member

Choose a reason for hiding this comment

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

btw not that clear what such a format is

type PutPrm struct {
obj *objectSDK.Object

binSet bool
Copy link
Member

Choose a reason for hiding this comment

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

undesired complexity to me. calling with empty bytes ends with no error (i guess) while that is incorrect for sure

@roman-khimov roman-khimov merged commit d58dc79 into master Apr 12, 2024
@roman-khimov roman-khimov deleted the feature/1723-engine-bin-write branch April 12, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants