belliottsmith commented on code in PR #7:
URL: https://github.com/apache/cassandra-accord/pull/7#discussion_r1013179725
##########
accord-core/src/main/java/accord/local/Status.java:
##########
@@ -18,29 +18,106 @@
package accord.local;
+import static accord.local.Status.ExecutionPhase.*;
+import static accord.local.Status.ReplicationPhase.*;
+
public enum Status
{
- NotWitnessed(0),
- PreAccepted(10),
- Accepted(20),
- AcceptedInvalidate(20),
- Committed(30),
- ReadyToExecute(40),
- Executed(50),
- Applied(60),
- Invalidated(60);
+ NotWitnessed(0, Phase.None, None, Undecided),
+ PreAccepted(10, Phase.PreAccept, Witness, Undecided),
+ AcceptedInvalidate(20, Phase.Accept, None, Undecided), // may or
may not have witnessed
+ Accepted(20, Phase.Accept, None, Undecided), // may or
may not have witnessed
+ Committed(30, Phase.Commit, Commit, Decided),
+ ReadyToExecute(30, Phase.Commit, Commit, Decided),
+ PreApplied(50, Phase.Persist, Apply, Decided),
+ Applied(50, Phase.Persist, Apply, Done),
+ Invalidated(60, Phase.Persist, Invalidate, Done);
- final int logicalOrdinal;
+ /**
+ * Represents the phase of a transaction from the perspective of
coordination
+ * PreAccept: the transaction is being disseminated and is seeking an
execution order
+ * Accept: the transaction did not achieve 1RT consensus and is making
durable its execution order
+ * Commit: the transaction's execution order has been durably decided,
and is being disseminated
+ * Persist: the transaction has executed, and its outcome is being
persisted
+ */
+ public enum Phase
+ {
+ // TODO: see if we can rename Commit here, or in ReplicationPhase, so
we can have disjoint terms
+ None, PreAccept, Accept, Commit, Persist
+ }
- Status(int logicalOrdinal)
+ /**
+ * Represents the phase of a transaction from the perspective of
dissemination of knowledge
+ * Witness: the transaction itself is known
+ * Commit: the decision around execution is known
+ * Apply: the transaction's execution outcome is known
+ * Invalidate: the transaction is known to be invalidated
+ */
+ public enum ReplicationPhase
{
- this.logicalOrdinal = logicalOrdinal;
+ None(false, false),
+ Witness(true, false),
Review Comment:
I decided to rename this again, to `Known` with the instances being nouns
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]