Search in sources :

Example 1 with LinearizabilityChecker

use of org.elasticsearch.cluster.coordination.LinearizabilityChecker in project crate by crate.

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.elasticsearch.cluster.coordination.LinearizabilityChecker) InputStreamStreamInput(org.elasticsearch.common.io.stream.InputStreamStreamInput) NamedWriteableAwareStreamInput(org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput) StreamInput(org.elasticsearch.common.io.stream.StreamInput) NamedWriteableAwareStreamInput(org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput) InputStreamStreamInput(org.elasticsearch.common.io.stream.InputStreamStreamInput) SuppressForbidden(io.crate.common.SuppressForbidden)

Aggregations

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