-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
Codecov Report
@@ Coverage Diff @@
## master #261 +/- ##
==========================================
- Coverage 34.62% 34.29% -0.33%
==========================================
Files 10 10
Lines 1369 1382 +13
==========================================
Hits 474 474
- Misses 852 866 +14
+ Partials 43 42 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
15f0295
to
7a79448
Compare
7a79448
to
a0b66e0
Compare
Signed-off-by: Evgenii Baidakov <[email protected]>
a0b66e0
to
0f9eb91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall LGTM, some cosmetics may be applied
utils/util.go
Outdated
func GetContainerID(ctx context.Context, containerID string, resolver *resolver.ContainerResolver) (*cid.ID, error) { | ||
cnrID := new(cid.ID) | ||
func GetContainerID(ctx context.Context, containerID string, resolver resolver.Resolver) (*cid.ID, error) { | ||
cnrID := cid.ID{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like useless change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change allows not to change other lines in the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, missed that Resolve
changed signature. I'd prefer
cnrID := cid.ID{} | |
var cnrID cid.ID |
but dont mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
uploader/upload.go
Outdated
return | ||
} | ||
|
||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can io.CopyBuffer
be used here? i see that we pass different messages into response.Error
, but taking into account we always respond with 500
don't think it's worth code complication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but as how benchmark showed in Slicer, this isn't so effective and consumes more memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then maybe add a comment about this before for
so that this question does not arise in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, but maybe I should make some local benchmark tests for object upload, separate from the slicer. Maybe it was a special case in than code.
Give me some time, I will post the result of my research here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect it to be around the same with io.Copy, but pay attention to buffer size (#148).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? The object may be big. We need to read it part by part. Writing yes, right now a little bit shorter, but anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just io.Copy()
? This would do the trick without loops/maxsizes. It can also be optimized if we're to provide ReaderFrom
(in the SDK) and/or WriterTo
(in the multipart handler).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider we want to use bigger buffers. io.Copy
uses 32kb buffers (if corresponding reader is not a LimitedReader, in our case in isn't), which too small, according to task #148.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I agree, io.CopyBuffer will help to remove the for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to io.CopyBuffer
99d25e0
to
bb91d85
Compare
Updated objectPut with |
app.go
Outdated
"github.com/nspcc-dev/neofs-sdk-go/user" | ||
"github.com/spf13/viper" | ||
"github.com/valyala/fasthttp" | ||
"go.uber.org/zap" | ||
) | ||
|
||
const ( | ||
defaultObjectSize = int64(2 << 21) // 2MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not 2MB but 4. If u need 2MB, then 1 << 21
or 2 << 20
(like more). If 4, then twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thought about 2^21, and as a result 2 << 21. Updated to 1 << 21
uploader/upload.go
Outdated
continue | ||
} | ||
|
||
if !errors.Is(err, io.EOF) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CopyN
doesn't return EOF
if !errors.Is(err, io.EOF) { | |
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns and without this check, it doesn't work
bb91d85
to
cd7049b
Compare
uploader/upload.go
Outdated
return | ||
} | ||
|
||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just io.Copy()
? This would do the trick without loops/maxsizes. It can also be optimized if we're to provide ReaderFrom
(in the SDK) and/or WriterTo
(in the multipart handler).
Signed-off-by: Evgenii Baidakov <[email protected]>
closes #260 Signed-off-by: Evgenii Baidakov <[email protected]>
cd7049b
to
50b36c6
Compare
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
50b36c6
to
465257d
Compare
closes #260