refactoring in routing logic to allow adding allocation explanation that later can be shown
This commit is contained in:
parent
b5b36215ae
commit
a1299a3d4f
|
@ -86,8 +86,13 @@ public class AllocationExplanation implements Streamable {
|
||||||
int size2 = in.readVInt();
|
int size2 = in.readVInt();
|
||||||
List<NodeExplanation> ne = Lists.newArrayListWithCapacity(size2);
|
List<NodeExplanation> ne = Lists.newArrayListWithCapacity(size2);
|
||||||
for (int j = 0; j < size2; j++) {
|
for (int j = 0; j < size2; j++) {
|
||||||
ne.add(new NodeExplanation(DiscoveryNode.readNode(in), in.readUTF()));
|
DiscoveryNode node = null;
|
||||||
|
if (in.readBoolean()) {
|
||||||
|
node = DiscoveryNode.readNode(in);
|
||||||
}
|
}
|
||||||
|
ne.add(new NodeExplanation(node, in.readUTF()));
|
||||||
|
}
|
||||||
|
explanations.put(shardId, ne);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +102,12 @@ public class AllocationExplanation implements Streamable {
|
||||||
entry.getKey().writeTo(out);
|
entry.getKey().writeTo(out);
|
||||||
out.writeVInt(entry.getValue().size());
|
out.writeVInt(entry.getValue().size());
|
||||||
for (NodeExplanation nodeExplanation : entry.getValue()) {
|
for (NodeExplanation nodeExplanation : entry.getValue()) {
|
||||||
|
if (nodeExplanation.node() == null) {
|
||||||
|
out.writeBoolean(false);
|
||||||
|
} else {
|
||||||
|
out.writeBoolean(true);
|
||||||
nodeExplanation.node().writeTo(out);
|
nodeExplanation.node().writeTo(out);
|
||||||
|
}
|
||||||
out.writeUTF(nodeExplanation.description());
|
out.writeUTF(nodeExplanation.description());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue