-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
storage.go
Outdated
@@ -473,6 +473,7 @@ func (s *Storage) read(ctx context.Context, path string, w io.Writer, opt pairSt | |||
input := &s3.GetObjectInput{ | |||
Bucket: aws.String(s.name), | |||
Key: aws.String(rp), | |||
Range: aws.String(fmt.Sprintf("bytes=%d-%d", opt.Offset, opt.Offset+opt.Size)), |
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.
Range
is [a, b]
, maybe we need to use opt.Offset+opt.Size-1
for end?
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.
BTW, we need to check offset and size before we use them.
- What if the offset is missing?
- What if the size is missing?
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.
Range
is[a, b]
, maybe we need to useopt.Offset+opt.Size-1
for end?
Got
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.
BTW, we need to check offset and size before we use them.
- What if the offset is missing?
- What if the size is missing?
Both offset and size are not pointer types, so we have to check whether size is greater than 0
storage.go
Outdated
@@ -474,6 +474,9 @@ func (s *Storage) read(ctx context.Context, path string, w io.Writer, opt pairSt | |||
Bucket: aws.String(s.name), | |||
Key: aws.String(rp), | |||
} | |||
if opt.Size > 0 { |
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.
Please use opt.HasXxxx
to check size
and offset
.
It's OK to eliminate the check for offset
, but please fill comments here for the reason.
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.
Modified, Please Review.
No description provided.