Search in sources :

Example 1 with LinearizabilityChecker

use of org.opensearch.cluster.coordination.LinearizabilityChecker in project OpenSearch by opensearch-project.

the class ConcurrentSeqNoVersioningIT method runLinearizabilityChecker.

@SuppressForbidden(reason = "system out is ok for a command line tool")
private static void runLinearizabilityChecker(FileInputStream fileInputStream, long primaryTerm, long seqNo) throws IOException {
    StreamInput is = new InputStreamStreamInput(Base64.getDecoder().wrap(fileInputStream));
    is = new NamedWriteableAwareStreamInput(is, createNamedWriteableRegistry());
    LinearizabilityChecker.History history = readHistory(is);
    Version initialVersion = new Version(primaryTerm, seqNo);
    boolean result = new LinearizabilityChecker().isLinearizable(new CASSequentialSpec(initialVersion), history, missingResponseGenerator());
    System.out.println(LinearizabilityChecker.visualize(new CASSequentialSpec(initialVersion), history, missingResponseGenerator()));
    System.out.println("Linearizable?: " + result);
}
Also used : LinearizabilityChecker(org.opensearch.cluster.coordination.LinearizabilityChecker) InputStreamStreamInput(org.opensearch.common.io.stream.InputStreamStreamInput) NamedWriteableAwareStreamInput(org.opensearch.common.io.stream.NamedWriteableAwareStreamInput) StreamInput(org.opensearch.common.io.stream.StreamInput) NamedWriteableAwareStreamInput(org.opensearch.common.io.stream.NamedWriteableAwareStreamInput) InputStreamStreamInput(org.opensearch.common.io.stream.InputStreamStreamInput) SuppressForbidden(org.opensearch.common.SuppressForbidden)

Aggregations

LinearizabilityChecker (org.opensearch.cluster.coordination.LinearizabilityChecker)1 SuppressForbidden (org.opensearch.common.SuppressForbidden)1 InputStreamStreamInput (org.opensearch.common.io.stream.InputStreamStreamInput)1 NamedWriteableAwareStreamInput (org.opensearch.common.io.stream.NamedWriteableAwareStreamInput)1 StreamInput (org.opensearch.common.io.stream.StreamInput)1