2020-08-17 09:08:11 +00:00
|
|
|
package storagegroup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
|
|
|
)
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// StorageGroup is a unified structure of StorageGroup
|
|
|
|
// message from proto definition.
|
2020-08-17 09:08:11 +00:00
|
|
|
type StorageGroup struct {
|
|
|
|
size uint64
|
|
|
|
|
2020-08-20 08:04:16 +00:00
|
|
|
hash *refs.Checksum
|
2020-08-17 09:08:11 +00:00
|
|
|
|
|
|
|
exp uint64
|
|
|
|
|
2022-03-01 12:50:09 +00:00
|
|
|
members []refs.ObjectID
|
2020-08-17 09:08:11 +00:00
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// GetValidationDataSize of unified storage group structure.
|
2020-08-17 09:08:11 +00:00
|
|
|
func (s *StorageGroup) GetValidationDataSize() uint64 {
|
|
|
|
if s != nil {
|
|
|
|
return s.size
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// SetValidationDataSize into unified storage group structure.
|
2020-08-17 09:08:11 +00:00
|
|
|
func (s *StorageGroup) SetValidationDataSize(v uint64) {
|
|
|
|
if s != nil {
|
|
|
|
s.size = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// GetValidationHash of unified storage group structure.
|
2020-08-20 08:04:16 +00:00
|
|
|
func (s *StorageGroup) GetValidationHash() *refs.Checksum {
|
2020-08-17 09:08:11 +00:00
|
|
|
if s != nil {
|
|
|
|
return s.hash
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// SetValidationHash into unified storage group structure.
|
2020-08-20 08:04:16 +00:00
|
|
|
func (s *StorageGroup) SetValidationHash(v *refs.Checksum) {
|
2020-08-17 09:08:11 +00:00
|
|
|
if s != nil {
|
|
|
|
s.hash = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// GetExpirationEpoch of unified storage group structure.
|
2020-08-17 09:08:11 +00:00
|
|
|
func (s *StorageGroup) GetExpirationEpoch() uint64 {
|
|
|
|
if s != nil {
|
|
|
|
return s.exp
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// SetExpirationEpoch into unified storage group structure.
|
2020-08-17 09:08:11 +00:00
|
|
|
func (s *StorageGroup) SetExpirationEpoch(v uint64) {
|
|
|
|
if s != nil {
|
|
|
|
s.exp = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// GetMembers of unified storage group structure. Members are objects of
|
|
|
|
// storage group.
|
2022-03-01 12:50:09 +00:00
|
|
|
func (s *StorageGroup) GetMembers() []refs.ObjectID {
|
2020-08-17 09:08:11 +00:00
|
|
|
if s != nil {
|
|
|
|
return s.members
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-08-17 12:19:36 +00:00
|
|
|
// SetMembers into unified storage group structure. Members are objects of
|
|
|
|
// storage group.
|
2022-03-01 12:50:09 +00:00
|
|
|
func (s *StorageGroup) SetMembers(v []refs.ObjectID) {
|
2020-08-17 09:08:11 +00:00
|
|
|
if s != nil {
|
|
|
|
s.members = v
|
|
|
|
}
|
|
|
|
}
|