diff --git a/pkg/local_object_storage/shard/info.go b/pkg/local_object_storage/shard/info.go index f195ee420..4c59e6172 100644 --- a/pkg/local_object_storage/shard/info.go +++ b/pkg/local_object_storage/shard/info.go @@ -3,6 +3,7 @@ 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" + "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" ) // Info groups the information about Shard. @@ -17,7 +18,7 @@ type Info struct { BlobStorInfo blobstor.Info // Information about the Write Cache. - WriteCacheInfo blobstor.Info + WriteCacheInfo writecache.Info // Weight parameters of the shard. WeightValues WeightValues diff --git a/pkg/local_object_storage/shard/shard.go b/pkg/local_object_storage/shard/shard.go index d4ca6768d..b585bc40a 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -84,13 +84,17 @@ func New(opts ...Option) *Shard { writecache.WithMetabase(mb))...) } - return &Shard{ + s := &Shard{ cfg: c, mode: atomic.NewUint32(0), // TODO: init with particular mode blobStor: bs, metaBase: mb, writeCache: writeCache, } + + s.fillInfo() + + return s } // WithID returns option to set shard identifier. @@ -192,3 +196,12 @@ func WithRefillMetabase(v bool) Option { c.refillMetabase = v } } + +func (s *Shard) fillInfo() { + s.cfg.info.MetaBaseInfo = s.metaBase.DumpInfo() + s.cfg.info.BlobStorInfo = s.blobStor.DumpInfo() + + if s.cfg.useWriteCache { + s.cfg.info.WriteCacheInfo = s.writeCache.DumpInfo() + } +} diff --git a/pkg/local_object_storage/writecache/writecache.go b/pkg/local_object_storage/writecache/writecache.go index dfbaaf707..fa9514131 100644 --- a/pkg/local_object_storage/writecache/writecache.go +++ b/pkg/local_object_storage/writecache/writecache.go @@ -9,12 +9,19 @@ import ( "go.uber.org/zap" ) +// Info groups the information about write-cache. +type Info struct { + // Full path to the write-cache. + Path string +} + // Cache represents write-cache for objects. type Cache interface { Get(*objectSDK.Address) (*object.Object, error) Head(*objectSDK.Address) (*object.Object, error) Delete(*objectSDK.Address) error Put(*object.Object) error + DumpInfo() Info Init() error Open() error @@ -90,6 +97,12 @@ func New(opts ...Option) Cache { return c } +func (c *cache) DumpInfo() Info { + return Info{ + Path: c.path, + } +} + // Open opens and initializes database. Reads object counters from the ObjectCounters instance. func (c *cache) Open() error { err := c.openStore()