[#1840] blobstor: Return info about all components
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
6d7ffefec5
commit
4b005d3178
12 changed files with 246 additions and 88 deletions
|
@ -77,18 +77,21 @@ func equalListShardResponseBodies(b1, b2 *control.ListShardsResponse_Body) bool
|
|||
|
||||
for i := range b1.Shards {
|
||||
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
|
||||
}
|
||||
|
||||
info1 := b1.Shards[i].GetBlobstor()
|
||||
info2 := b2.Shards[i].GetBlobstor()
|
||||
return compareBlobstorInfo(info1, info2)
|
||||
}
|
||||
|
||||
for i := range b1.Shards {
|
||||
for j := i + 1; j < len(b1.Shards); j++ {
|
||||
if b1.Shards[i].GetMetabasePath() == b2.Shards[j].GetMetabasePath() ||
|
||||
b1.Shards[i].GetBlobstorPath() == b2.Shards[j].GetBlobstorPath() ||
|
||||
!compareBlobstorInfo(b1.Shards[i].Blobstor, b2.Shards[i].Blobstor) ||
|
||||
b1.Shards[i].GetWritecachePath() == b2.Shards[j].GetWritecachePath() ||
|
||||
bytes.Equal(b1.Shards[i].GetShard_ID(), b2.Shards[j].GetShard_ID()) {
|
||||
return false
|
||||
|
@ -98,6 +101,18 @@ func equalListShardResponseBodies(b1, b2 *control.ListShardsResponse_Body) bool
|
|||
|
||||
return true
|
||||
}
|
||||
func compareBlobstorInfo(a, b []*control.BlobstorInfo) bool {
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
for i := range a {
|
||||
if a[i].Type != b[i].Type ||
|
||||
a[i].Path != b[i].Path {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func generateListShardsResponseBody() *control.ListShardsResponse_Body {
|
||||
body := new(control.ListShardsResponse_Body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue