[#1141] metabase: Fix IsUserObject method

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-05-20 13:19:51 +03:00
parent 89a80e9a0f
commit 40b04c00ef

View file

@ -527,11 +527,15 @@ func containerObjectCounterInitialized(tx *bbolt.Tx) bool {
} }
func IsUserObject(obj *objectSDK.Object) bool { func IsUserObject(obj *objectSDK.Object) bool {
ech := obj.ECHeader()
if ech == nil {
_, hasParentID := obj.ParentID() _, hasParentID := obj.ParentID()
return obj.Type() == objectSDK.TypeRegular && return obj.Type() == objectSDK.TypeRegular &&
(obj.SplitID() == nil || (obj.SplitID() == nil ||
(hasParentID && len(obj.Children()) == 0)) (hasParentID && len(obj.Children()) == 0))
} }
return ech.Index() == 0 && (ech.ParentSplitID() == nil || ech.ParentSplitParentID() != nil)
}
// ZeroSizeContainers returns containers with size = 0. // ZeroSizeContainers returns containers with size = 0.
func (db *DB) ZeroSizeContainers(ctx context.Context) ([]cid.ID, error) { func (db *DB) ZeroSizeContainers(ctx context.Context) ([]cid.ID, error) {