MCPcopy
hub / github.com/rclone/rclone / headObject

Method headObject

backend/s3/s3.go:3983–4011  ·  view source on GitHub ↗
(ctx context.Context, req *s3.HeadObjectInput)

Source from the content-addressed store, hash-verified

3981}
3982
3983func (f *Fs) headObject(ctx context.Context, req *s3.HeadObjectInput) (resp *s3.HeadObjectOutput, err error) {
3984 if f.opt.RequesterPays {
3985 req.RequestPayer = types.RequestPayerRequester
3986 }
3987 if f.opt.SSECustomerAlgorithm != "" {
3988 req.SSECustomerAlgorithm = &f.opt.SSECustomerAlgorithm
3989 }
3990 if f.opt.SSECustomerKeyBase64 != "" {
3991 req.SSECustomerKey = &f.opt.SSECustomerKeyBase64
3992 }
3993 if f.opt.SSECustomerKeyMD5 != "" {
3994 req.SSECustomerKeyMD5 = &f.opt.SSECustomerKeyMD5
3995 }
3996 err = f.pacer.Call(func() (bool, error) {
3997 var err error
3998 resp, err = f.c.HeadObject(ctx, req)
3999 return f.shouldRetry(ctx, err)
4000 })
4001 if err != nil {
4002 if statusCode := getHTTPStatusCode(err); statusCode == http.StatusNotFound || statusCode == http.StatusMethodNotAllowed {
4003 return nil, fs.ErrorObjectNotFound
4004 }
4005 return nil, err
4006 }
4007 if req.Bucket != nil {
4008 f.cache.MarkOK(*req.Bucket)
4009 }
4010 return resp, nil
4011}
4012
4013// readMetaData gets the metadata if it hasn't already been fetched
4014//

Callers 3

listMethod · 0.95
copyMultipartMethod · 0.45
headObjectMethod · 0.45

Calls 5

shouldRetryMethod · 0.95
getHTTPStatusCodeFunction · 0.85
HeadObjectMethod · 0.80
MarkOKMethod · 0.80
CallMethod · 0.45

Tested by

no test coverage detected