[#1402] ir: Do not use map for combining SG ID and SG object

Also, add corresponding structure for that.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-07-01 21:45:18 +03:00 committed by fyrchik
parent ec07fda97b
commit a153e040cb
4 changed files with 41 additions and 13 deletions

View file

@ -4,9 +4,9 @@ import (
"context"
"github.com/nspcc-dev/neofs-node/pkg/core/client"
"github.com/nspcc-dev/neofs-sdk-go/container/id"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/netmap"
"github.com/nspcc-dev/neofs-sdk-go/object/id"
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
"github.com/nspcc-dev/neofs-sdk-go/storagegroup"
)
@ -46,3 +46,29 @@ type SGSource interface {
// container and netmap state.
GetSG(GetSGPrm) (*storagegroup.StorageGroup, error)
}
// StorageGroup combines storage group object ID and its structure.
type StorageGroup struct {
id oid.ID
sg storagegroup.StorageGroup
}
// ID returns object ID of the storage group.
func (s StorageGroup) ID() oid.ID {
return s.id
}
// SetID sets an object ID of the storage group.
func (s *StorageGroup) SetID(id oid.ID) {
s.id = id
}
// StorageGroup returns the storage group descriptor.
func (s StorageGroup) StorageGroup() storagegroup.StorageGroup {
return s.sg
}
// SetStorageGroup sets a storage group descriptor.
func (s *StorageGroup) SetStorageGroup(sg storagegroup.StorageGroup) {
s.sg = sg
}