[#248] core: Remove storage group

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-04-25 09:35:58 +03:00
parent f1ea8fec93
commit 586f5986bc
3 changed files with 0 additions and 164 deletions

View file

@ -14,7 +14,6 @@ import (
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"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/frostfs-sdk-go/user"
)
@ -65,8 +64,6 @@ var errNoExpirationEpoch = errors.New("missing expiration epoch attribute")
var errTombstoneExpiration = errors.New("tombstone body and header contain different expiration values")
var errEmptySGMembers = errors.New("storage group with empty members list")
func defaultCfg() *cfg {
return new(cfg)
}
@ -180,7 +177,6 @@ func (v *FormatValidator) checkOwnerKey(id user.ID, key frostfsecdsa.PublicKey)
// ContentMeta describes FrostFS meta information that brings object's payload if the object
// is one of:
// - object.TypeTombstone;
// - object.TypeStorageGroup;
// - object.TypeLock.
type ContentMeta struct {
typ object.Type
@ -196,7 +192,6 @@ func (i ContentMeta) Type() object.Type {
// Objects returns objects that the original object's payload affects:
// - inhumed objects, if the original object is a Tombstone;
// - locked objects, if the original object is a Lock;
// - members of a storage group, if the original object is a Storage group;
// - nil, if the original object is a Regular object.
func (i ContentMeta) Objects() []oid.ID {
return i.objs
@ -213,10 +208,6 @@ func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error)
if err := v.fillAndValidateTombstoneMeta(o, &meta); err != nil {
return ContentMeta{}, err
}
case object.TypeStorageGroup:
if err := v.fillAndValidateStorageGroupMeta(o, &meta); err != nil {
return ContentMeta{}, err
}
case object.TypeLock:
if err := v.fillAndValidateLockMeta(o, &meta); err != nil {
return ContentMeta{}, err
@ -266,37 +257,6 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *Conten
return nil
}
func (v *FormatValidator) fillAndValidateStorageGroupMeta(o *object.Object, meta *ContentMeta) error {
if len(o.Payload()) == 0 {
return fmt.Errorf("(%T) empty payload in storage group", v)
}
var sg storagegroup.StorageGroup
if err := sg.Unmarshal(o.Payload()); err != nil {
return fmt.Errorf("(%T) could not unmarshal storage group content: %w", v, err)
}
mm := sg.Members()
meta.objs = mm
lenMM := len(mm)
if lenMM == 0 {
return errEmptySGMembers
}
uniqueFilter := make(map[oid.ID]struct{}, lenMM)
for i := 0; i < lenMM; i++ {
if _, alreadySeen := uniqueFilter[mm[i]]; alreadySeen {
return fmt.Errorf("storage group contains non-unique member: %s", mm[i])
}
uniqueFilter[mm[i]] = struct{}{}
}
return nil
}
func (v *FormatValidator) fillAndValidateTombstoneMeta(o *object.Object, meta *ContentMeta) error {
if len(o.Payload()) == 0 {
return fmt.Errorf("(%T) empty payload in tombstone", v)