forked from TrueCloudLab/frostfs-node
[#1333] services/control: Return pilorama info in ListShards
RPC
Do not return backend type from the service for now, because memory backend is expected to vanish. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
62b2769a66
commit
5408efef82
15 changed files with 43 additions and 0 deletions
|
@ -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()),
|
||||
|
|
24
pkg/local_object_storage/pilorama/info.go
Normal file
24
pkg/local_object_storage/pilorama/info.go
Normal file
|
@ -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",
|
||||
}
|
||||
}
|
|
@ -36,6 +36,8 @@ type Forest interface {
|
|||
}
|
||||
|
||||
type ForestStorage interface {
|
||||
// DumpInfo returns information about the pilorama.
|
||||
DumpInfo() Info
|
||||
Init() error
|
||||
Open() error
|
||||
Close() error
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
BIN
pkg/services/control/types.pb.go
generated
BIN
pkg/services/control/types.pb.go
generated
Binary file not shown.
|
@ -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.
|
||||
|
|
BIN
pkg/services/control/types_neofs.pb.go
generated
BIN
pkg/services/control/types_neofs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
||||
|
|
BIN
pkg/services/tree/service.pb.go
generated
BIN
pkg/services/tree/service.pb.go
generated
Binary file not shown.
BIN
pkg/services/tree/service_grpc.pb.go
generated
BIN
pkg/services/tree/service_grpc.pb.go
generated
Binary file not shown.
BIN
pkg/services/tree/types.pb.go
generated
BIN
pkg/services/tree/types.pb.go
generated
Binary file not shown.
Loading…
Reference in a new issue