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 f9f3a01f8..7e5a039ba 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -255,4 +255,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 --- a/pkg/services/control/types.pb.go +++ b/pkg/services/control/types.pb.go @@ -404,6 +404,8 @@ type ShardInfo struct { Mode ShardMode `protobuf:"varint,5,opt,name=mode,proto3,enum=control.ShardMode" json:"mode,omitempty"` // Amount of errors occured. ErrorCount uint32 `protobuf:"varint,6,opt,name=errorCount,proto3" json:"errorCount,omitempty"` + // Path to shard's pilorama storage. + PiloramaPath string `protobuf:"bytes,7,opt,name=pilorama_path,json=piloramaPath,proto3" json:"pilorama_path,omitempty"` } func (x *ShardInfo) Reset() { @@ -480,6 +482,13 @@ func (x *ShardInfo) GetErrorCount() uint32 { return 0 } +func (x *ShardInfo) GetPiloramaPath() string { + if x != nil { + return x.PiloramaPath + } + return "" +} + // Administrator-defined Attributes of the NeoFS Storage Node. // // `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 @@ -616,7 +625,7 @@ var file_pkg_services_control_types_proto_rawDesc = []byte{ 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x27, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, - 0xe1, 0x01, 0x0a, 0x09, 0x53, 0x68, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, + 0x86, 0x02, 0x0a, 0x09, 0x53, 0x68, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, 0x49, 0x44, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, @@ -630,26 +639,29 @@ var file_pkg_services_control_types_proto_rawDesc = []byte{ 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x2a, 0x4e, 0x0a, 0x0c, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, - 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, - 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, - 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, - 0x45, 0x10, 0x03, 0x2a, 0x57, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x17, 0x48, 0x45, 0x41, 0x4c, 0x54, 0x48, 0x5f, 0x53, 0x54, - 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, - 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x48, 0x55, - 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x2a, 0x52, 0x0a, 0x09, - 0x53, 0x68, 0x61, 0x72, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x48, 0x41, - 0x52, 0x44, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x41, 0x44, 0x5f, 0x57, 0x52, 0x49, 0x54, - 0x45, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x45, 0x41, 0x44, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, - 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x47, 0x52, 0x41, 0x44, 0x45, 0x44, 0x10, 0x03, - 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, - 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x6e, - 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x69, 0x6c, 0x6f, 0x72, 0x61, 0x6d, 0x61, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x69, 0x6c, 0x6f, + 0x72, 0x61, 0x6d, 0x61, 0x50, 0x61, 0x74, 0x68, 0x2a, 0x4e, 0x0a, 0x0c, 0x4e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, + 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, + 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, + 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x2a, 0x57, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x17, 0x48, 0x45, 0x41, 0x4c, + 0x54, 0x48, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, + 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, + 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02, 0x12, 0x11, + 0x0a, 0x0d, 0x53, 0x48, 0x55, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, + 0x03, 0x2a, 0x52, 0x0a, 0x09, 0x53, 0x68, 0x61, 0x72, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, + 0x0a, 0x14, 0x53, 0x48, 0x41, 0x52, 0x44, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, + 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x41, 0x44, + 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x45, 0x41, 0x44, + 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x47, 0x52, 0x41, + 0x44, 0x45, 0x44, 0x10, 0x03, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, + 0x6f, 0x66, 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( 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 --- a/pkg/services/control/types_neofs.pb.go +++ b/pkg/services/control/types_neofs.pb.go @@ -148,6 +148,7 @@ func (x *ShardInfo) StableSize() (size int) { size += proto.StringSize(4, x.WritecachePath) size += proto.EnumSize(5, int32(x.Mode)) size += proto.UInt32Size(6, x.ErrorCount) + size += proto.StringSize(7, x.PiloramaPath) return size } @@ -173,5 +174,6 @@ func (x *ShardInfo) StableMarshal(buf []byte) []byte { offset += proto.StringMarshal(4, buf[offset:], x.WritecachePath) offset += proto.EnumMarshal(5, buf[offset:], int32(x.Mode)) offset += proto.UInt32Marshal(6, buf[offset:], x.ErrorCount) + offset += proto.StringMarshal(7, buf[offset:], x.PiloramaPath) return buf } 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 --- a/pkg/services/tree/service.pb.go +++ b/pkg/services/tree/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.20.1 +// protoc v3.21.1 // source: pkg/services/tree/service.proto package tree diff --git a/pkg/services/tree/service_grpc.pb.go b/pkg/services/tree/service_grpc.pb.go index 956a00329..7de60958c 100644 --- a/pkg/services/tree/service_grpc.pb.go +++ b/pkg/services/tree/service_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.20.1 +// - protoc v3.21.1 // source: pkg/services/tree/service.proto package tree diff --git a/pkg/services/tree/types.pb.go b/pkg/services/tree/types.pb.go index 0a2dfb087..5a2173073 100644 --- a/pkg/services/tree/types.pb.go +++ b/pkg/services/tree/types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.20.1 +// protoc v3.21.1 // source: pkg/services/tree/types.proto package tree