public class LivenessInfo
extends java.lang.Object
A LivenessInfo
can first be empty. If it isn't, it contains at least a timestamp,
which is the timestamp for the row primary key columns. On top of that, the info can be
ttl'ed, in which case the LivenessInfo
also has both a ttl and a local expiration time.
Please note that if a liveness info is ttl'ed, that expiration is only an expiration
of the liveness info itself (so, of the timestamp), and once the info expires it becomes
EMPTY
. But if a row has a liveness info which expires, the rest of the row data is
unaffected (of course, the rest of said row data might be ttl'ed on its own but this is
separate).
Modifier and Type | Field and Description |
---|---|
static LivenessInfo |
EMPTY |
static int |
EXPIRED_LIVENESS_TTL
Used as flag for representing an expired liveness.
|
static int |
NO_EXPIRATION_TIME |
static long |
NO_TIMESTAMP |
static int |
NO_TTL |
protected long |
timestamp |
Modifier | Constructor and Description |
---|---|
protected |
LivenessInfo(long timestamp) |
Modifier and Type | Method and Description |
---|---|
static LivenessInfo |
create(CFMetaData metadata,
long timestamp,
int nowInSec) |
static LivenessInfo |
create(CFMetaData metadata,
long timestamp,
int ttl,
int nowInSec) |
static LivenessInfo |
create(long timestamp,
int ttl,
int localExpirationTime) |
int |
dataSize()
The size of the (useful) data this liveness information contains.
|
void |
digest(java.security.MessageDigest digest)
Adds this liveness information to the provided digest.
|
boolean |
equals(java.lang.Object other) |
static LivenessInfo |
expiring(long timestamp,
int ttl,
int nowInSec) |
int |
hashCode() |
boolean |
isEmpty()
Whether this liveness info is empty (has no timestamp).
|
protected boolean |
isExpired() |
boolean |
isExpiring()
Whether the info has a ttl.
|
boolean |
isLive(int nowInSec)
Whether that info is still live.
|
int |
localExpirationTime()
The expiration time (in seconds) if the info is expiring (
NO_EXPIRATION_TIME otherwise). |
boolean |
supersedes(LivenessInfo other)
Whether this liveness information supersedes another one (that is
whether is has a greater timestamp than the other or not).
|
long |
timestamp()
The timestamp for this liveness info.
|
java.lang.String |
toString() |
int |
ttl()
The ttl (if any) on the row primary key columns or
NO_TTL if it is not
expiring. |
void |
validate()
Validate the data contained by this liveness information.
|
LivenessInfo |
withUpdatedTimestamp(long newTimestamp)
Returns a copy of this liveness info updated with the provided timestamp.
|
LivenessInfo |
withUpdatedTimestampAndLocalDeletionTime(long newTimestamp,
int newLocalDeletionTime) |
public static final long NO_TIMESTAMP
public static final int NO_TTL
public static final int EXPIRED_LIVENESS_TTL
Attributes.MAX_TTL
)public static final int NO_EXPIRATION_TIME
public static final LivenessInfo EMPTY
protected final long timestamp
public static LivenessInfo create(CFMetaData metadata, long timestamp, int nowInSec)
public static LivenessInfo expiring(long timestamp, int ttl, int nowInSec)
public static LivenessInfo create(CFMetaData metadata, long timestamp, int ttl, int nowInSec)
public static LivenessInfo create(long timestamp, int ttl, int localExpirationTime)
public boolean isEmpty()
public long timestamp()
NO_TIMESTAMP
if the info is empty).public boolean isExpiring()
public int ttl()
NO_TTL
if it is not
expiring.
Please note that this value is the TTL that was set originally and is thus not
changing.public int localExpirationTime()
NO_EXPIRATION_TIME
otherwise).public boolean isLive(int nowInSec)
LivenessInfo
is live if it is either not expiring, or if its expiration time if after
nowInSec
.nowInSec
- the current time in seconds.public void digest(java.security.MessageDigest digest)
digest
- the digest to add this liveness information to.public void validate()
MarshalException
- if some of the data is corrupted.public int dataSize()
public boolean supersedes(LivenessInfo other)
Conflicts.resolveRegular(long, boolean, int, java.nio.ByteBuffer, long, boolean, int, java.nio.ByteBuffer)
If timestamps are the same and one of them is expired livenessInfo. Expired livenessInfo
supersedes, ie. tombstone supersedes.
If timestamps are the same and both of them are expired livenessInfo(Ideally it shouldn't happen),
greater localDeletionTime wins.other
- the LivenessInfo
to compare this info to.LivenessInfo
supersedes other
.protected boolean isExpired()
public LivenessInfo withUpdatedTimestamp(long newTimestamp)
newTimestamp
- the timestamp for the returned info.newTimestamp
as timestamp. If it has no timestamp however, this liveness info is returned
unchanged.public LivenessInfo withUpdatedTimestampAndLocalDeletionTime(long newTimestamp, int newLocalDeletionTime)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2018 The Apache Software Foundation