From f1ea8fec9302d8779f485a485de15601c5cd49c8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 25 Apr 2023 09:32:48 +0300 Subject: [PATCH] [#248] object_manager: Remove storage group Signed-off-by: Evgenii Stratonikov --- .../object_manager/storagegroup/collect.go | 67 ------------------- .../object_manager/storagegroup/search.go | 14 ---- 2 files changed, 81 deletions(-) delete mode 100644 pkg/services/object_manager/storagegroup/collect.go delete mode 100644 pkg/services/object_manager/storagegroup/search.go diff --git a/pkg/services/object_manager/storagegroup/collect.go b/pkg/services/object_manager/storagegroup/collect.go deleted file mode 100644 index d9578dea3..000000000 --- a/pkg/services/object_manager/storagegroup/collect.go +++ /dev/null @@ -1,67 +0,0 @@ -package storagegroup - -import ( - objutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" - cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/storagegroup" - "git.frostfs.info/TrueCloudLab/tzhash/tz" -) - -// CollectMembers creates new storage group structure and fills it -// with information about members collected via HeadReceiver. -// -// Resulting storage group consists of physically stored objects only. -func CollectMembers(r objutil.HeadReceiver, cnr cid.ID, members []oid.ID, calcHomoHash bool) (*storagegroup.StorageGroup, error) { - var ( - sumPhySize uint64 - phyMembers []oid.ID - phyHashes [][]byte - addr oid.Address - sg storagegroup.StorageGroup - ) - - addr.SetContainer(cnr) - - for i := range members { - addr.SetObject(members[i]) - - if err := objutil.IterateAllSplitLeaves(r, addr, func(leaf *object.Object) { - id, ok := leaf.ID() - if !ok { - return - } - - phyMembers = append(phyMembers, id) - sumPhySize += leaf.PayloadSize() - cs, _ := leaf.PayloadHomomorphicHash() - - if calcHomoHash { - phyHashes = append(phyHashes, cs.Value()) - } - }); err != nil { - return nil, err - } - } - - sg.SetMembers(phyMembers) - sg.SetValidationDataSize(sumPhySize) - - if calcHomoHash { - sumHash, err := tz.Concat(phyHashes) - if err != nil { - return nil, err - } - - var cs checksum.Checksum - tzHash := [64]byte{} - copy(tzHash[:], sumHash) - cs.SetTillichZemor(tzHash) - - sg.SetValidationDataHash(cs) - } - - return &sg, nil -} diff --git a/pkg/services/object_manager/storagegroup/search.go b/pkg/services/object_manager/storagegroup/search.go deleted file mode 100644 index 39019aa6d..000000000 --- a/pkg/services/object_manager/storagegroup/search.go +++ /dev/null @@ -1,14 +0,0 @@ -package storagegroup - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" -) - -// SearchQuery returns search query to filter -// objects with storage group content. -func SearchQuery() object.SearchFilters { - fs := object.SearchFilters{} - fs.AddTypeFilter(object.MatchStringEqual, object.TypeStorageGroup) - - return fs -}