From 4f16a10235e4637e021c1e933487a8b60bb7903a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 19 Nov 2020 16:54:21 +0300 Subject: [PATCH] [#189] localstorage: Implement DumpInfo method Implement method to get the information about the local storage. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/engine/info.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pkg/local_object_storage/engine/info.go diff --git a/pkg/local_object_storage/engine/info.go b/pkg/local_object_storage/engine/info.go new file mode 100644 index 000000000..16683fb97 --- /dev/null +++ b/pkg/local_object_storage/engine/info.go @@ -0,0 +1,24 @@ +package engine + +import ( + "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard" +) + +// Info groups the information about StorageEngine. +type Info struct { + Shards []shard.Info +} + +// DumpInfo returns information about the StorageEngine. +func (e *StorageEngine) DumpInfo() (i Info) { + e.mtx.RLock() + defer e.mtx.RUnlock() + + i.Shards = make([]shard.Info, 0, len(e.shards)) + + for _, sh := range e.shards { + i.Shards = append(i.Shards, sh.DumpInfo()) + } + + return +}