Package org.apache.cassandra.service
Class QueryState
- java.lang.Object
-
- org.apache.cassandra.service.QueryState
-
public class QueryState extends java.lang.ObjectPrimarily used as a recorder for server-generated timestamps (timestamp, in microseconds, and nowInSeconds - in, well, seconds). The goal is to be able to use a single consistent server-generated value for both timestamps across the whole request, and later be able to inspect QueryState for the generated values - for logging or other purposes.
-
-
Constructor Summary
Constructors Constructor Description QueryState(ClientState clientState)QueryState(ClientState clientState, long timestamp, int nowInSeconds)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static QueryStateforInternalCalls()intgeneratedNowInSeconds()longgeneratedTimestamp()java.net.InetAddressgetClientAddress()ClientStategetClientState()intgetNowInSeconds()Generate, cache, and record a nowInSeconds value on the server-side.longgetTimestamp()Generate, cache, and record a timestamp value on the server-side.
-
-
-
Constructor Detail
-
QueryState
public QueryState(ClientState clientState)
-
QueryState
public QueryState(ClientState clientState, long timestamp, int nowInSeconds)
-
-
Method Detail
-
forInternalCalls
public static QueryState forInternalCalls()
- Returns:
- a QueryState object for internal C* calls (not limited by any kind of auth).
-
getTimestamp
public long getTimestamp()
Generate, cache, and record a timestamp value on the server-side. Used in reads for all live and expiring cells, and all kinds of deletion infos. Shouldn't be used directly.QueryOptions.getTimestamp(QueryState)should be used by all consumers.- Returns:
- server-generated, recorded timestamp in seconds
-
getNowInSeconds
public int getNowInSeconds()
Generate, cache, and record a nowInSeconds value on the server-side. In writes is used for calculating localDeletionTime for tombstones and expiring cells and other deletion infos. In reads used to determine liveness of expiring cells and rows. Shouldn't be used directly.QueryOptions.getNowInSeconds(QueryState)should be used by all consumers.- Returns:
- server-generated, recorded timestamp in seconds
-
generatedTimestamp
public long generatedTimestamp()
- Returns:
- server-generated timestamp value, if one had been requested, or Long.MIN_VALUE otherwise
-
generatedNowInSeconds
public int generatedNowInSeconds()
- Returns:
- server-generated nowInSeconds value, if one had been requested, or Integer.MIN_VALUE otherwise
-
getClientState
public ClientState getClientState()
-
getClientAddress
public java.net.InetAddress getClientAddress()
-
-