Search in sources :

Example 1 with AnnotatedClusterState

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);
}
Also used : AnnotatedClusterState(com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState) ClusterState(com.yahoo.vdslib.state.ClusterState) HashMap(java.util.HashMap) AnnotatedClusterState(com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState)

Aggregations

ClusterState (com.yahoo.vdslib.state.ClusterState)1 AnnotatedClusterState (com.yahoo.vespa.clustercontroller.core.AnnotatedClusterState)1 HashMap (java.util.HashMap)1