use of com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState in project vespa by vespa-engine.
the class SlimeClusterStateBundleCodec method decode.
@Override
public ClusterStateBundle decode(EncodedClusterStateBundle encodedClusterStateBundle) {
byte[] uncompressed = compressor.decompress(encodedClusterStateBundle.getCompression());
Slime slime = BinaryFormat.decode(uncompressed);
Inspector root = slime.get();
Inspector states = root.field("states");
ClusterState baseline = ClusterState.stateFromString(states.field("baseline").asString());
Inspector spaces = states.field("spaces");
Map<String, AnnotatedClusterState> derivedStates = new HashMap<>();
spaces.traverse(((ObjectTraverser) (key, value) -> {
derivedStates.put(key, AnnotatedClusterState.withoutAnnotations(ClusterState.stateFromString(value.asString())));
}));
return ClusterStateBundle.of(AnnotatedClusterState.withoutAnnotations(baseline), derivedStates);
}
Aggregations