From 8fbda2a5889240a0551ef1c4ae0e5e2b8c97044a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 19 Nov 2020 16:53:45 +0300 Subject: [PATCH] [#189] shard: Implement DumpInfo method Implement method to get the information about the shard. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/shard/id.go | 2 +- pkg/local_object_storage/shard/info.go | 23 +++++++++++++++++++++++ pkg/local_object_storage/shard/shard.go | 4 ++-- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 pkg/local_object_storage/shard/info.go diff --git a/pkg/local_object_storage/shard/id.go b/pkg/local_object_storage/shard/id.go index c9558d35e..9121a8ec5 100644 --- a/pkg/local_object_storage/shard/id.go +++ b/pkg/local_object_storage/shard/id.go @@ -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 } diff --git a/pkg/local_object_storage/shard/info.go b/pkg/local_object_storage/shard/info.go new file mode 100644 index 000000000..465a802d0 --- /dev/null +++ b/pkg/local_object_storage/shard/info.go @@ -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 +} diff --git a/pkg/local_object_storage/shard/shard.go b/pkg/local_object_storage/shard/shard.go index 14773de6e..8e5833cff 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -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 } }