[#4] Don't check tags for multiparts
Spec https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html#lc-expire-mpu says: "When you use the AbortIncompleteMultipartUpload S3 Lifecycle action, the rule cannot specify a tag-based filter." Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
15c9d55b03
commit
2613504b94
1 changed files with 1 additions and 35 deletions
|
@ -156,10 +156,7 @@ func (e *Executor) worker(ctx context.Context, job Job) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
creationEpochKV = "CreationEpoch"
|
||||
tagPrefix = "S3-Tag-"
|
||||
)
|
||||
const creationEpochKV = "CreationEpoch"
|
||||
|
||||
func (e *Executor) abortMultiparts(ctx context.Context, ni *netmap.NetworkInfo, rules []data.LifecycleRule, bktInfo *data.BucketInfo) error {
|
||||
if len(rules) == 0 {
|
||||
|
@ -244,10 +241,6 @@ func (e *Executor) matchMultipartByRuleFn(ni *netmap.NetworkInfo, rule data.Life
|
|||
if filter.And != nil {
|
||||
prefix = filter.And.Prefix
|
||||
}
|
||||
|
||||
if filter.Tag != nil || filter.And != nil {
|
||||
matchMultipartByTags = matchMultipartByTagsFunc(filter)
|
||||
}
|
||||
}
|
||||
|
||||
return func(multipart *data.MultipartInfo) bool {
|
||||
|
@ -670,33 +663,6 @@ func versionCreationEpoch(version *data.NodeVersion, ni *netmap.NetworkInfo) (ui
|
|||
return objCreationEpoch, nil
|
||||
}
|
||||
|
||||
func matchMultipartByTagsFunc(filter *data.LifecycleRuleFilter) func(*data.MultipartInfo) bool {
|
||||
return func(info *data.MultipartInfo) bool {
|
||||
tags := make(map[string]string)
|
||||
for k, v := range info.Meta {
|
||||
if strings.HasPrefix(k, tagPrefix) {
|
||||
tags[k[len(tagPrefix):]] = v
|
||||
}
|
||||
}
|
||||
|
||||
if filter.Tag != nil {
|
||||
if tags[filter.Tag.Key] != filter.Tag.Value {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if filter.And != nil {
|
||||
for _, tag := range filter.And.Tags {
|
||||
if tags[tag.Key] != tag.Value {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Executor) abortMultipart(ctx context.Context, bktInfo *data.BucketInfo, multipart *data.MultipartInfo) error {
|
||||
parts, err := e.tree.GetParts(ctx, bktInfo, multipart.ID)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue