2023-08-24 12:27:24 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
2024-10-01 12:27:06 +00:00
|
|
|
containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
2023-08-24 12:27:24 +00:00
|
|
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
|
|
|
)
|
|
|
|
|
2023-08-24 12:35:19 +00:00
|
|
|
// WasRemoved checks whether the container ever existed or
|
2023-08-24 12:27:24 +00:00
|
|
|
// it just has not been created yet at the current epoch.
|
2023-08-24 12:35:19 +00:00
|
|
|
func WasRemoved(s Source, cid cid.ID) (bool, error) {
|
2023-08-24 12:27:24 +00:00
|
|
|
_, err := s.DeletionInfo(cid)
|
|
|
|
if err == nil {
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
var errContainerNotFound *apistatus.ContainerNotFound
|
|
|
|
if errors.As(err, &errContainerNotFound) {
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
return false, err
|
|
|
|
}
|
2024-10-01 12:27:06 +00:00
|
|
|
|
|
|
|
// IsIndexedContainer returns True if container attributes should be indexed.
|
|
|
|
func IsIndexedContainer(cnr containerSDK.Container) bool {
|
|
|
|
var isS3Container bool
|
|
|
|
cnr.IterateAttributes(func(key, _ string) {
|
|
|
|
if key == ".s3-location-constraint" {
|
|
|
|
isS3Container = true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return !isS3Container
|
|
|
|
}
|