mirror of
https://github.com/rclone/rclone.git
synced 2024-11-08 01:25:14 +01:00
backend/tardigrade: use negative offset
v1.4.6 of uplink allows us to do a negative offset from the end of the file. This removes a round trip when requesting the last N bytes of a file. Previous to v1.4.6 of uplink it wasn't possible to do a negative offset on download. This meant that to fulfill the semantics of http range headers it was necessary to first fetch the size of the object via a stat call and compute absolute offset and length.
This commit is contained in:
parent
f8d56bebaf
commit
a1a41aa0c1
@ -148,13 +148,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (_ io.ReadC
|
||||
case s && !e:
|
||||
offset = opt.Start
|
||||
case !s && e:
|
||||
object, err := o.fs.project.StatObject(ctx, bucketName, bucketPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
offset = object.System.ContentLength - opt.End
|
||||
length = opt.End
|
||||
offset = -opt.End
|
||||
}
|
||||
case *fs.SeekOption:
|
||||
offset = opt.Offset
|
||||
|
Loading…
Reference in New Issue
Block a user