Class LinearizabilityChecker.History
- java.lang.Object
-
- org.elasticsearch.cluster.coordination.LinearizabilityChecker.History
-
- Enclosing class:
- LinearizabilityChecker
public static class LinearizabilityChecker.History extends java.lang.ObjectSequence of invocations and responses, recording the run of a concurrent system.
-
-
Constructor Summary
Constructors Constructor Description History()History(java.util.Collection<LinearizabilityChecker.Event> events)
-
Method Summary
Modifier and Type Method Description LinearizabilityChecker.Historyclone()voidcomplete(java.util.function.Function<java.lang.Object,java.lang.Object> missingResponseGenerator)Completes the history with response events for invocations that are missing corresponding responsesjava.util.List<LinearizabilityChecker.Event>copyEvents()Copy the list of events for external use.intinvoke(java.lang.Object input)Appends a new invocation event to the historyvoidremove(int id)Removes the events with the corresponding id from the historyvoidrespond(int id, java.lang.Object output)Appends a new response event to the historyintsize()Returns the number of recorded eventsjava.lang.StringtoString()
-
-
-
Constructor Detail
-
History
public History()
-
History
public History(java.util.Collection<LinearizabilityChecker.Event> events)
-
-
Method Detail
-
invoke
public int invoke(java.lang.Object input)
Appends a new invocation event to the history- Parameters:
input- the input value associated with the invocation event- Returns:
- an id that can be used to record the corresponding response event
-
respond
public void respond(int id, java.lang.Object output)Appends a new response event to the history- Parameters:
id- the id of the corresponding invocation eventoutput- the output value associated with the response event
-
remove
public void remove(int id)
Removes the events with the corresponding id from the history- Parameters:
id- the value of the id to remove
-
copyEvents
public java.util.List<LinearizabilityChecker.Event> copyEvents()
Copy the list of events for external use.- Returns:
- list of events in the order recorded.
-
complete
public void complete(java.util.function.Function<java.lang.Object,java.lang.Object> missingResponseGenerator)
Completes the history with response events for invocations that are missing corresponding responses- Parameters:
missingResponseGenerator- a function from invocation input to response output, used to generate the corresponding response
-
clone
public LinearizabilityChecker.History clone()
- Overrides:
clonein classjava.lang.Object
-
size
public int size()
Returns the number of recorded events
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-