forked from TrueCloudLab/restic
s3: Use context
This commit is contained in:
parent
934ae1b559
commit
8b3b7bc5ef
1 changed files with 3 additions and 3 deletions
|
@ -304,7 +304,7 @@ func (be *Backend) Save(ctx context.Context, h restic.Handle, rd io.Reader) (err
|
||||||
opts.ContentType = "application/octet-stream"
|
opts.ContentType = "application/octet-stream"
|
||||||
|
|
||||||
debug.Log("PutObject(%v, %v, %v)", be.cfg.Bucket, objName, size)
|
debug.Log("PutObject(%v, %v, %v)", be.cfg.Bucket, objName, size)
|
||||||
n, err := be.client.PutObject(be.cfg.Bucket, objName, ioutil.NopCloser(rd), size, opts)
|
n, err := be.client.PutObjectWithContext(ctx, be.cfg.Bucket, objName, ioutil.NopCloser(rd), size, opts)
|
||||||
|
|
||||||
debug.Log("%v -> %v bytes, err %#v: %v", objName, n, err, err)
|
debug.Log("%v -> %v bytes, err %#v: %v", objName, n, err, err)
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ func (be *Backend) Load(ctx context.Context, h restic.Handle, length int, offset
|
||||||
|
|
||||||
be.sem.GetToken()
|
be.sem.GetToken()
|
||||||
coreClient := minio.Core{Client: be.client}
|
coreClient := minio.Core{Client: be.client}
|
||||||
rd, _, err := coreClient.GetObject(be.cfg.Bucket, objName, opts)
|
rd, err := coreClient.GetObjectWithContext(ctx, be.cfg.Bucket, objName, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
be.sem.ReleaseToken()
|
be.sem.ReleaseToken()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -385,7 +385,7 @@ func (be *Backend) Stat(ctx context.Context, h restic.Handle) (bi restic.FileInf
|
||||||
opts := minio.GetObjectOptions{}
|
opts := minio.GetObjectOptions{}
|
||||||
|
|
||||||
be.sem.GetToken()
|
be.sem.GetToken()
|
||||||
obj, err = be.client.GetObject(be.cfg.Bucket, objName, opts)
|
obj, err = be.client.GetObjectWithContext(ctx, be.cfg.Bucket, objName, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
debug.Log("GetObject() err %v", err)
|
debug.Log("GetObject() err %v", err)
|
||||||
be.sem.ReleaseToken()
|
be.sem.ReleaseToken()
|
||||||
|
|
Loading…
Reference in a new issue