[#189] shard: Implement DumpInfo method

Implement method to get the information about the shard.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-19 16:53:45 +03:00 committed by Alex Vanin
parent 24cf86e269
commit 8fbda2a588
3 changed files with 26 additions and 3 deletions

View file

@ -21,5 +21,5 @@ func (id ID) String() string {
// ID returns Shard identifier.
func (s *Shard) ID() *ID {
return s.id
return s.info.ID
}

View file

@ -0,0 +1,23 @@
package shard
import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
)
// Info groups the information about Shard.
type Info struct {
// Identifier of the shard.
ID *ID
// Information about the metabase.
MetaBaseInfo meta.Info
// Information about the BLOB storage.
BlobStorInfo blobstor.Info
}
// DumpInfo returns information about the Shard.
func (s *Shard) DumpInfo() Info {
return s.info
}

View file

@ -24,7 +24,7 @@ type Shard struct {
type Option func(*cfg)
type cfg struct {
id *ID
info Info
blobOpts []blobstor.Option
@ -56,7 +56,7 @@ func New(opts ...Option) *Shard {
// WithID returns option to set shard identifier.
func WithID(id *ID) Option {
return func(c *cfg) {
c.id = id
c.info.ID = id
}
}