[#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:
parent
24cf86e269
commit
8fbda2a588
3 changed files with 26 additions and 3 deletions
|
@ -21,5 +21,5 @@ func (id ID) String() string {
|
||||||
|
|
||||||
// ID returns Shard identifier.
|
// ID returns Shard identifier.
|
||||||
func (s *Shard) ID() *ID {
|
func (s *Shard) ID() *ID {
|
||||||
return s.id
|
return s.info.ID
|
||||||
}
|
}
|
||||||
|
|
23
pkg/local_object_storage/shard/info.go
Normal file
23
pkg/local_object_storage/shard/info.go
Normal 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
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ type Shard struct {
|
||||||
type Option func(*cfg)
|
type Option func(*cfg)
|
||||||
|
|
||||||
type cfg struct {
|
type cfg struct {
|
||||||
id *ID
|
info Info
|
||||||
|
|
||||||
blobOpts []blobstor.Option
|
blobOpts []blobstor.Option
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ func New(opts ...Option) *Shard {
|
||||||
// WithID returns option to set shard identifier.
|
// WithID returns option to set shard identifier.
|
||||||
func WithID(id *ID) Option {
|
func WithID(id *ID) Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.id = id
|
c.info.ID = id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue