d8ba954aff
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
34 lines
594 B
Go
34 lines
594 B
Go
package shard
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
|
)
|
|
|
|
type ContainerSizePrm struct {
|
|
cnr cid.ID
|
|
}
|
|
|
|
type ContainerSizeRes struct {
|
|
size uint64
|
|
}
|
|
|
|
func (p *ContainerSizePrm) SetContainerID(cnr cid.ID) {
|
|
p.cnr = cnr
|
|
}
|
|
|
|
func (r ContainerSizeRes) Size() uint64 {
|
|
return r.size
|
|
}
|
|
|
|
func (s *Shard) ContainerSize(prm ContainerSizePrm) (ContainerSizeRes, error) {
|
|
size, err := s.metaBase.ContainerSize(prm.cnr)
|
|
if err != nil {
|
|
return ContainerSizeRes{}, fmt.Errorf("could not get container size: %w", err)
|
|
}
|
|
|
|
return ContainerSizeRes{
|
|
size: size,
|
|
}, nil
|
|
}
|