2023-08-24 12:27:24 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
|
|
|
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
|
|
|
|
}
|