Class Commit
- java.lang.Object
-
- org.apache.cassandra.service.paxos.Commit
-
- Direct Known Subclasses:
Commit.Proposal
public class Commit extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommit.Acceptedstatic classCommit.AcceptedWithTTLstatic classCommit.Agreedstatic classCommit.CommitSerializer<T extends Commit>static classCommit.Committedstatic classCommit.CommittedWithTTLstatic classCommit.Proposal
-
Field Summary
Fields Modifier and Type Field Description Ballotballotstatic Commit.CommitSerializer<Commit>serializerPartitionUpdateupdate
-
Constructor Summary
Constructors Constructor Description Commit(Ballot ballot, PartitionUpdate update)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.cassandra.service.paxos.Commit.CompareResultcompareWith(Commit that)static CommitemptyCommit(DecoratedKey partitionKey, TableMetadata metadata)booleanequals(java.lang.Object o)booleanhasBallot(Ballot ballot)inthashCode()booleanhasSameBallot(Commit other)booleanisAfter(Ballot otherBallot)static booleanisAfter(Ballot testIsAfter, Ballot testIsBefore)static booleanisAfter(Ballot testIsAfter, Commit testIsBefore)booleanisAfter(Commit other)static booleanisAfter(Commit testIsAfter, Ballot testIsBefore)static booleanisAfter(Commit testIsAfter, Commit testIsBefore)booleanisBefore(Ballot otherBallot)booleanisReproposalOf(Commit older)We can witness reproposals of the latest successful commit; we can detect this by comparing the timestamp of the update with our ballot; if it is the same, we are not a reproposal.booleanisSameOrAfter(Ballot otherBallot)static <C extends Commit>
Clatest(C a, C b)the latest of two ballots, or the first ballot if equal timestampsstatic Ballotlatest(Ballot a, Ballot b)the latest of two ballots, or the first ballot if equal timestampsstatic Ballotlatest(Commit a, Ballot b)the latest of two ballots, or the first ballot if equal timestampsMutationmakeMutation()static CommitnewPrepare(DecoratedKey partitionKey, TableMetadata metadata, Ballot ballot)static CommitnewProposal(Ballot ballot, PartitionUpdate update)Deprecated.static booleantimestampsClash(Ballot a, Ballot b)static booleantimestampsClash(Commit a, Ballot b)unequal ballots with same timestampjava.lang.StringtoString()java.lang.StringtoString(java.lang.String kind)
-
-
-
Field Detail
-
serializer
public static final Commit.CommitSerializer<Commit> serializer
-
ballot
public final Ballot ballot
-
update
public final PartitionUpdate update
-
-
Constructor Detail
-
Commit
public Commit(Ballot ballot, PartitionUpdate update)
-
-
Method Detail
-
newPrepare
public static Commit newPrepare(DecoratedKey partitionKey, TableMetadata metadata, Ballot ballot)
-
emptyCommit
public static Commit emptyCommit(DecoratedKey partitionKey, TableMetadata metadata)
-
newProposal
@Deprecated public static Commit newProposal(Ballot ballot, PartitionUpdate update)
Deprecated.
-
isAfter
public boolean isAfter(Commit other)
-
isSameOrAfter
public boolean isSameOrAfter(@Nullable Ballot otherBallot)
-
isAfter
public boolean isAfter(@Nullable Ballot otherBallot)
-
isBefore
public boolean isBefore(@Nullable Ballot otherBallot)
-
hasBallot
public boolean hasBallot(Ballot ballot)
-
hasSameBallot
public boolean hasSameBallot(Commit other)
-
makeMutation
public Mutation makeMutation()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String kind)
-
isReproposalOf
public boolean isReproposalOf(Commit older)
We can witness reproposals of the latest successful commit; we can detect this by comparing the timestamp of the update with our ballot; if it is the same, we are not a reproposal. If it is the same as either the ballot timestamp or update timestamp of the latest committed proposal, then we are reproposing it and can instead simpy commit it.
-
compareWith
public org.apache.cassandra.service.paxos.Commit.CompareResult compareWith(Commit that)
-
isAfter
public static boolean isAfter(@Nullable Commit testIsAfter, @Nullable Commit testIsBefore)- Returns:
- testIfAfter.isAfter(testIfBefore), with non-null > null
-
isAfter
public static boolean isAfter(@Nullable Ballot testIsAfter, @Nullable Commit testIsBefore)- Returns:
- testIfAfter.isAfter(testIfBefore), with non-null > null
-
isAfter
public static boolean isAfter(@Nullable Commit testIsAfter, @Nullable Ballot testIsBefore)- Returns:
- testIfAfter.isAfter(testIfBefore), with non-null > null
-
isAfter
public static boolean isAfter(@Nullable Ballot testIsAfter, @Nullable Ballot testIsBefore)- Returns:
- testIfAfter.isAfter(testIfBefore), with non-null > null
-
latest
public static <C extends Commit> C latest(@Nullable C a, @Nullable C b)
the latest of two ballots, or the first ballot if equal timestamps
-
latest
public static Ballot latest(@Nullable Commit a, @Nullable Ballot b)
the latest of two ballots, or the first ballot if equal timestamps
-
latest
public static Ballot latest(@Nullable Ballot a, @Nullable Ballot b)
the latest of two ballots, or the first ballot if equal timestamps
-
timestampsClash
public static boolean timestampsClash(@Nullable Commit a, @Nullable Ballot b)unequal ballots with same timestamp
-
-