Add IsRemote method on FileInfo, ObjectInfo (#12209)

Provides a convenient method to know if an object's contents are in its remote
tier.
This commit is contained in:
Krishnan Parthasarathi
2021-05-04 08:40:42 -07:00
committed by GitHub
parent e948e7cdf6
commit 860bf1bab2
5 changed files with 86 additions and 14 deletions

View File

@@ -201,12 +201,10 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp
}
}
}
if objInfo.TransitionStatus == lifecycle.TransitionComplete {
if objInfo.IsRemote() {
// Check if object is being restored. For more information on x-amz-restore header see
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html#API_HeadObject_ResponseSyntax
if onDisk := isRestoredObjectOnDisk(objInfo.UserDefined); !onDisk {
w.Header()[xhttp.AmzStorageClass] = []string{objInfo.TransitionTier}
}
w.Header()[xhttp.AmzStorageClass] = []string{objInfo.TransitionTier}
}
ruleID, transitionTime := lc.PredictTransitionTime(lifecycle.ObjectOpts{
Name: objInfo.Name,