diff --git a/cmd/neofs-cli/modules/control/shards_list.go b/cmd/neofs-cli/modules/control/shards_list.go index 7244ebd0d..9ee986805 100644 --- a/cmd/neofs-cli/modules/control/shards_list.go +++ b/cmd/neofs-cli/modules/control/shards_list.go @@ -93,6 +93,7 @@ func prettyPrintShards(cmd *cobra.Command, ii []*control.ShardInfo) { pathPrinter("Metabase", i.GetMetabasePath())+ pathPrinter("Blobstor", i.GetBlobstorPath())+ pathPrinter("Write-cache", i.GetWritecachePath())+ + pathPrinter("Pilorama", i.GetPiloramaPath())+ fmt.Sprintf("Error count: %d\n", i.GetErrorCount()), base58.Encode(i.Shard_ID), shardModeToString(i.GetMode()), diff --git a/pkg/local_object_storage/pilorama/info.go b/pkg/local_object_storage/pilorama/info.go new file mode 100644 index 000000000..0040b9dca --- /dev/null +++ b/pkg/local_object_storage/pilorama/info.go @@ -0,0 +1,24 @@ +package pilorama + +// Info groups the information about the pilorama. +type Info struct { + // Path contains path to the root-directory of the pilorama. + Path string + // Backend is the pilorama storage type. Either "boltdb" or "memory". + Backend string +} + +// DumpInfo implements the ForestStorage interface. +func (t *boltForest) DumpInfo() Info { + return Info{ + Path: t.path, + Backend: "boltdb", + } +} + +// DumpInfo implements the ForestStorage interface. +func (f *memoryForest) DumpInfo() Info { + return Info{ + Backend: "memory", + } +} diff --git a/pkg/local_object_storage/pilorama/interface.go b/pkg/local_object_storage/pilorama/interface.go index 92c47b6af..6d685e951 100644 --- a/pkg/local_object_storage/pilorama/interface.go +++ b/pkg/local_object_storage/pilorama/interface.go @@ -36,6 +36,8 @@ type Forest interface { } type ForestStorage interface { + // DumpInfo returns information about the pilorama. + DumpInfo() Info Init() error Open() error Close() error diff --git a/pkg/local_object_storage/shard/info.go b/pkg/local_object_storage/shard/info.go index fbc26e519..deb46cd44 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/pilorama" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" ) @@ -28,6 +29,9 @@ type Info struct { // ErrorCount contains amount of errors occurred in shard operations. ErrorCount uint32 + + // PiloramaInfo contains information about trees stored on this shard. + PiloramaInfo pilorama.Info } // DumpInfo returns information about the Shard. diff --git a/pkg/local_object_storage/shard/shard.go b/pkg/local_object_storage/shard/shard.go index f682b273e..93361326a 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -242,4 +242,5 @@ func (s *Shard) fillInfo() { if s.cfg.useWriteCache { s.cfg.info.WriteCacheInfo = s.writeCache.DumpInfo() } + s.cfg.info.PiloramaInfo = s.pilorama.DumpInfo() } diff --git a/pkg/services/control/server/list_shards.go b/pkg/services/control/server/list_shards.go index 3cc89284b..d896ec6d0 100644 --- a/pkg/services/control/server/list_shards.go +++ b/pkg/services/control/server/list_shards.go @@ -32,6 +32,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) ( si.SetMetabasePath(sh.MetaBaseInfo.Path) si.SetBlobstorPath(sh.BlobStorInfo.RootPath) si.SetWriteCachePath(sh.WriteCacheInfo.Path) + si.SetPiloramaPath(sh.PiloramaInfo.Path) var mode control.ShardMode diff --git a/pkg/services/control/service_test.go b/pkg/services/control/service_test.go index c80d8ee8f..8a3167543 100644 --- a/pkg/services/control/service_test.go +++ b/pkg/services/control/service_test.go @@ -103,6 +103,7 @@ func equalListShardResponseBodies(b1, b2 *control.ListShardsResponse_Body) bool if b1.Shards[i].GetMetabasePath() != b2.Shards[i].GetMetabasePath() || b1.Shards[i].GetBlobstorPath() != b2.Shards[i].GetBlobstorPath() || b1.Shards[i].GetWritecachePath() != b2.Shards[i].GetWritecachePath() || + b1.Shards[i].GetPiloramaPath() != b2.Shards[i].GetPiloramaPath() || !bytes.Equal(b1.Shards[i].GetShard_ID(), b2.Shards[i].GetShard_ID()) { return false } diff --git a/pkg/services/control/types.go b/pkg/services/control/types.go index 4d4c11196..406a1896a 100644 --- a/pkg/services/control/types.go +++ b/pkg/services/control/types.go @@ -107,6 +107,11 @@ func (x *ShardInfo) SetWriteCachePath(v string) { x.WritecachePath = v } +// SetPiloramaPath sets path to shard's pilorama. +func (x *ShardInfo) SetPiloramaPath(v string) { + x.PiloramaPath = v +} + // SetMode sets path to shard's work mode. func (x *ShardInfo) SetMode(v ShardMode) { x.Mode = v diff --git a/pkg/services/control/types.pb.go b/pkg/services/control/types.pb.go index 2b1ee9008..c22eb0a7e 100644 Binary files a/pkg/services/control/types.pb.go and b/pkg/services/control/types.pb.go differ diff --git a/pkg/services/control/types.proto b/pkg/services/control/types.proto index a786c7b12..f9c8cef2c 100644 --- a/pkg/services/control/types.proto +++ b/pkg/services/control/types.proto @@ -139,6 +139,9 @@ message ShardInfo { // Amount of errors occured. uint32 errorCount = 6; + + // Path to shard's pilorama storage. + string pilorama_path = 7 [json_name = "piloramaPath"]; } // Work mode of the shard. diff --git a/pkg/services/control/types_neofs.pb.go b/pkg/services/control/types_neofs.pb.go index 5fe19be94..8dd46362e 100644 Binary files a/pkg/services/control/types_neofs.pb.go and b/pkg/services/control/types_neofs.pb.go differ diff --git a/pkg/services/control/types_test.go b/pkg/services/control/types_test.go index 31c3885dc..40a0d17a9 100644 --- a/pkg/services/control/types_test.go +++ b/pkg/services/control/types_test.go @@ -140,6 +140,7 @@ func generateShardInfo(id int) *control.ShardInfo { si.SetMetabasePath(filepath.Join(path, "meta")) si.SetBlobstorPath(filepath.Join(path, "blobstor")) si.SetWriteCachePath(filepath.Join(path, "writecache")) + si.SetPiloramaPath(filepath.Join(path, "pilorama")) return si } diff --git a/pkg/services/tree/service.pb.go b/pkg/services/tree/service.pb.go index 77947522f..a278e5827 100644 Binary files a/pkg/services/tree/service.pb.go and b/pkg/services/tree/service.pb.go differ diff --git a/pkg/services/tree/service_grpc.pb.go b/pkg/services/tree/service_grpc.pb.go index 956a00329..7de60958c 100644 Binary files a/pkg/services/tree/service_grpc.pb.go and b/pkg/services/tree/service_grpc.pb.go differ diff --git a/pkg/services/tree/types.pb.go b/pkg/services/tree/types.pb.go index 0a2dfb087..5a2173073 100644 Binary files a/pkg/services/tree/types.pb.go and b/pkg/services/tree/types.pb.go differ