Package io.lettuce.core
Class ConnectionState
- java.lang.Object
-
- io.lettuce.core.ConnectionState
-
public class ConnectionState extends Object
Internal connection state representing the negotiatedProtocolVersion
and other options for connection initialization and connection state restoration. This class is part of the internal API.- Since:
- 6.0
- Author:
- Mark Paluch, Jon Iantosca
-
-
Constructor Summary
Constructors Constructor Description ConnectionState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(RedisURI redisURI)
Applies settings fromRedisURI
.Long
getConnectionId()
Returns the client connection id.RedisCredentialsProvider
getCredentialsProvider()
String
getMode()
Returns the Redis server mode.ProtocolVersion
getNegotiatedProtocolVersion()
Returns the negotiatedProtocolVersion
.String
getRedisVersion()
Returns the Redis server version.String
getRole()
Returns the Redis server role.protected void
setClientName(String clientName)
protected void
setCredentialsProvider(RedisCredentialsProvider credentialsProvider)
protected void
setDb(int db)
protected void
setReadOnly(boolean readOnly)
protected void
setUserNamePassword(List<char[]> args)
Sets username/password state based on the argument count from anAUTH
command.
-
-
-
Method Detail
-
apply
public void apply(RedisURI redisURI)
Applies settings fromRedisURI
.- Parameters:
redisURI
- the URI to apply the client name and authentication.
-
getNegotiatedProtocolVersion
public ProtocolVersion getNegotiatedProtocolVersion()
Returns the negotiatedProtocolVersion
.- Returns:
- the negotiated
ProtocolVersion
once the connection is established.
-
getConnectionId
public Long getConnectionId()
Returns the client connection id. Only available when usingProtocolVersion.RESP3
.- Returns:
- the client connection id. Can be
null
if Redis uses RESP2.
-
getRedisVersion
public String getRedisVersion()
Returns the Redis server version. Only available when usingProtocolVersion.RESP3
.- Returns:
- the Redis server version.
-
getMode
public String getMode()
Returns the Redis server mode. Only available when usingProtocolVersion.RESP3
.- Returns:
- the Redis server mode.
-
getRole
public String getRole()
Returns the Redis server role. Only available when usingProtocolVersion.RESP3
.- Returns:
- the Redis server role.
-
setUserNamePassword
protected void setUserNamePassword(List<char[]> args)
Sets username/password state based on the argument count from anAUTH
command.- Parameters:
args
-
-
setCredentialsProvider
protected void setCredentialsProvider(RedisCredentialsProvider credentialsProvider)
-
getCredentialsProvider
public RedisCredentialsProvider getCredentialsProvider()
-
setDb
protected void setDb(int db)
-
setReadOnly
protected void setReadOnly(boolean readOnly)
-
setClientName
protected void setClientName(String clientName)
-
-