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 class
Commit.Accepted
static class
Commit.AcceptedWithTTL
static class
Commit.Agreed
static class
Commit.CommitSerializer<T extends Commit>
static class
Commit.Committed
static class
Commit.CommittedWithTTL
static class
Commit.Proposal
-
Field Summary
Fields Modifier and Type Field Description Ballot
ballot
static Commit.CommitSerializer<Commit>
serializer
PartitionUpdate
update
-
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.CompareResult
compareWith(Commit that)
static Commit
emptyCommit(DecoratedKey partitionKey, TableMetadata metadata)
boolean
equals(java.lang.Object o)
boolean
hasBallot(Ballot ballot)
int
hashCode()
boolean
hasSameBallot(Commit other)
boolean
isAfter(Ballot otherBallot)
static boolean
isAfter(Ballot testIsAfter, Ballot testIsBefore)
static boolean
isAfter(Ballot testIsAfter, Commit testIsBefore)
boolean
isAfter(Commit other)
static boolean
isAfter(Commit testIsAfter, Ballot testIsBefore)
static boolean
isAfter(Commit testIsAfter, Commit testIsBefore)
boolean
isBefore(Ballot otherBallot)
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.boolean
isSameOrAfter(Ballot otherBallot)
static <C extends Commit>
Clatest(C a, C b)
the latest of two ballots, or the first ballot if equal timestampsstatic Ballot
latest(Ballot a, Ballot b)
the latest of two ballots, or the first ballot if equal timestampsstatic Ballot
latest(Commit a, Ballot b)
the latest of two ballots, or the first ballot if equal timestampsMutation
makeMutation()
static Commit
newPrepare(DecoratedKey partitionKey, TableMetadata metadata, Ballot ballot)
static Commit
newProposal(Ballot ballot, PartitionUpdate update)
Deprecated.See CASSANDRA-17164static boolean
timestampsClash(Ballot a, Ballot b)
static boolean
timestampsClash(Commit a, Ballot b)
unequal ballots with same timestampjava.lang.String
toString()
java.lang.String
toString(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(since="4.1") public static Commit newProposal(Ballot ballot, PartitionUpdate update)
Deprecated.See CASSANDRA-17164
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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
-
-