MCPcopy Index your code
hub / github.com/rclone/rclone / readObjectInfo

Method readObjectInfo

backend/googlecloudstorage/googlecloudstorage.go:1287–1305  ·  view source on GitHub ↗

readObjectInfo reads the definition for an object

(ctx context.Context, bucket, bucketPath string)

Source from the content-addressed store, hash-verified

1285
1286// readObjectInfo reads the definition for an object
1287func (f *Fs) readObjectInfo(ctx context.Context, bucket, bucketPath string) (object *storage.Object, err error) {
1288 err = f.pacer.Call(func() (bool, error) {
1289 get := f.svc.Objects.Get(bucket, bucketPath).Context(ctx)
1290 if f.opt.UserProject != "" {
1291 get = get.UserProject(f.opt.UserProject)
1292 }
1293 object, err = get.Do()
1294 return shouldRetry(ctx, err)
1295 })
1296 if err != nil {
1297 if gErr, ok := err.(*googleapi.Error); ok {
1298 if gErr.Code == http.StatusNotFound {
1299 return nil, fs.ErrorObjectNotFound
1300 }
1301 }
1302 return nil, err
1303 }
1304 return object, nil
1305}
1306
1307// readMetaData gets the metadata if it hasn't already been fetched
1308//

Callers 2

listMethod · 0.95
readObjectInfoMethod · 0.45

Calls 4

shouldRetryFunction · 0.70
GetMethod · 0.65
DoMethod · 0.65
CallMethod · 0.45

Tested by

no test coverage detected