2022-07-01 18:16:28 +00:00
|
|
|
package storagegroup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
|
|
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
|
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/storagegroup"
|
2022-07-01 18:16:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SearchSGPrm groups the parameters which are formed by Processor to search the storage group objects.
|
|
|
|
type SearchSGPrm struct {
|
|
|
|
Container cid.ID
|
|
|
|
|
|
|
|
NodeInfo client.NodeInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SearchSGDst groups the target values which Processor expects from SG searching to process.
|
|
|
|
type SearchSGDst struct {
|
|
|
|
Objects []oid.ID
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetSGPrm groups parameter of GetSG operation.
|
|
|
|
type GetSGPrm struct {
|
|
|
|
OID oid.ID
|
|
|
|
CID cid.ID
|
|
|
|
|
|
|
|
NetMap netmap.NetMap
|
|
|
|
Container [][]netmap.NodeInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SGSource is a storage group information source interface.
|
|
|
|
type SGSource interface {
|
|
|
|
// ListSG must list storage group objects in the container. Formed list must be written to destination.
|
|
|
|
//
|
|
|
|
// Must return any error encountered which did not allow to form the list.
|
2023-04-06 10:41:45 +00:00
|
|
|
ListSG(context.Context, *SearchSGDst, SearchSGPrm) error
|
2022-07-01 18:16:28 +00:00
|
|
|
|
|
|
|
// GetSG must return storage group object for the provided CID, OID,
|
|
|
|
// container and netmap state.
|
2023-04-06 10:41:45 +00:00
|
|
|
GetSG(context.Context, GetSGPrm) (*storagegroup.StorageGroup, error)
|
2022-07-01 18:16:28 +00:00
|
|
|
}
|
2022-07-01 18:45:18 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|