Package com.clickhouse.client
Class ClickHouseConfig
- java.lang.Object
-
- com.clickhouse.client.ClickHouseConfig
-
- All Implemented Interfaces:
Serializable
public class ClickHouseConfig extends Object implements Serializable
An immutable class holding client-specific options likeClickHouseCredentialsandClickHouseNodeSelectoretc.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ClickHouseConfig(ClickHouseConfig... configs)Construct a new configuration by consolidating given ones.ClickHouseConfig(List<ClickHouseConfig> configs)Construct a new configuration by consolidating given ones.ClickHouseConfig(Map<ClickHouseOption,Serializable> options, ClickHouseCredentials credentials, ClickHouseNodeSelector nodeSelector, Object metricRegistry)Default contructor.
-
Method Summary
-
-
-
Constructor Detail
-
ClickHouseConfig
public ClickHouseConfig(ClickHouseConfig... configs)
Construct a new configuration by consolidating given ones.- Parameters:
configs- list of configuration
-
ClickHouseConfig
public ClickHouseConfig(List<ClickHouseConfig> configs)
Construct a new configuration by consolidating given ones.- Parameters:
configs- list of configuration
-
ClickHouseConfig
public ClickHouseConfig(Map<ClickHouseOption,Serializable> options, ClickHouseCredentials credentials, ClickHouseNodeSelector nodeSelector, Object metricRegistry)
Default contructor.- Parameters:
options- generic optionscredentials- default credentialnodeSelector- node selectormetricRegistry- metric registry
-
-
Method Detail
-
mergeOptions
protected static final Map<ClickHouseOption,Serializable> mergeOptions(List<ClickHouseConfig> list)
-
mergeCredentials
protected static final ClickHouseCredentials mergeCredentials(List<ClickHouseConfig> list)
-
mergeNodeSelector
protected static final ClickHouseNodeSelector mergeNodeSelector(List<ClickHouseConfig> list)
-
mergeMetricRegistry
protected static final Object mergeMetricRegistry(List<ClickHouseConfig> list)
-
toClientOptions
public static Map<ClickHouseOption,Serializable> toClientOptions(Map<?,?> props)
Converts given key-value pairs to a mutable map of correspondingClickHouseOption.- Parameters:
props- key-value pairs- Returns:
- non-null mutable map of client options
-
isAsync
public boolean isAsync()
-
isAutoDiscovery
public boolean isAutoDiscovery()
-
getClientName
public String getClientName()
-
isResponseCompressed
public boolean isResponseCompressed()
Checks if server response is compressed or not.- Returns:
- true if server response is compressed; false otherwise
-
getResponseCompressAlgorithm
public ClickHouseCompression getResponseCompressAlgorithm()
Gets server response compress algorithm. WhenisResponseCompressed()isfalse, this will returnClickHouseCompression.NONE.- Returns:
- non-null compress algorithm
-
getResponseCompressLevel
public int getResponseCompressLevel()
- Returns:
- compress level
-
isCompressServerResponse
@Deprecated public boolean isCompressServerResponse()
Deprecated.will be removed in v0.3.3, please useisResponseCompressed()insteadChecks if server response should be compressed or not.- Returns:
- true if server response is compressed; false otherwise
-
getCompressAlgorithmForServerResponse
@Deprecated public ClickHouseCompression getCompressAlgorithmForServerResponse()
Deprecated.will be removed in v0.3.3, please usegetResponseCompressAlgorithm()insteadGets compress algorithm for server response.- Returns:
- compress algorithm for server response
-
getCompressLevelForServerResponse
@Deprecated public int getCompressLevelForServerResponse()
Deprecated.will be removed in v0.3.3, please usegetResponseCompressLevel()insteadGets compress level for server response.- Returns:
- compress level
-
isRequestCompressed
public boolean isRequestCompressed()
Checks if client's output, aka. client request, should be compressed or not.- Returns:
- true if client request should be compressed; false otherwise
-
getRequestCompressAlgorithm
public ClickHouseCompression getRequestCompressAlgorithm()
Gets input compress algorithm. WhenisRequestCompressed()isfalse, this will returnClickHouseCompression.NONE.- Returns:
- non-null compress algorithm
-
getRequestCompressLevel
public int getRequestCompressLevel()
- Returns:
- compress level
-
isDecompressClientRequet
@Deprecated public boolean isDecompressClientRequet()
Deprecated.will be removed in v0.3.3, please useisRequestCompressed()insteadChecks if client request should be compressed or not.- Returns:
- true if server needs to decompress client request; false otherwise
-
getDecompressAlgorithmForClientRequest
@Deprecated public ClickHouseCompression getDecompressAlgorithmForClientRequest()
Deprecated.will be removed in v0.3.3, please usegetRequestCompressAlgorithm()insteadGets compress algorithm for client request.- Returns:
- compress algorithm for client request
-
getDecompressLevelForClientRequest
@Deprecated public int getDecompressLevelForClientRequest()
Deprecated.will be removed in v0.3.3, please usegetRequestCompressLevel()insteadGets compress level for client request.- Returns:
- compress level
-
getConnectionTimeout
public int getConnectionTimeout()
-
getDatabase
public String getDatabase()
-
getFormat
public ClickHouseFormat getFormat()
-
getNodeCheckInterval
public int getNodeCheckInterval()
-
getMaxBufferSize
public int getMaxBufferSize()
Gets max buffer size in byte can be used for streaming.- Returns:
- max buffer size in byte
-
getBufferSize
public int getBufferSize()
Gets default buffer size in byte for both read and write.- Returns:
- default buffer size in byte
-
getBufferQueueVariation
public int getBufferQueueVariation()
Gets number of times the buffer queue is filled up before increasing capacity of buffer queue. Zero or negative value means the queue length is fixed.- Returns:
- variation
-
getReadBufferSize
public int getReadBufferSize()
Gets read buffer size in byte.- Returns:
- read buffer size in byte
-
getWriteBufferSize
public int getWriteBufferSize()
Gets write buffer size in byte.- Returns:
- write buffer size in byte
-
getRequestChunkSize
public int getRequestChunkSize()
Gets request chunk size.- Returns:
- request chunk size
-
getRequestBuffering
public ClickHouseBufferingMode getRequestBuffering()
Gets request buffering mode.- Returns:
- request buffering mode
-
getResponseBuffering
public ClickHouseBufferingMode getResponseBuffering()
Gets response buffering mode.- Returns:
- response buffering mode
-
getMaxExecutionTime
public int getMaxExecutionTime()
-
getMaxQueuedBuffers
public int getMaxQueuedBuffers()
-
getMaxQueuedRequests
public int getMaxQueuedRequests()
-
getMaxResultRows
public long getMaxResultRows()
-
getMaxThreadsPerClient
public int getMaxThreadsPerClient()
-
getFailover
public int getFailover()
-
getRetry
public int getRetry()
-
isRepeatOnSessionLock
public boolean isRepeatOnSessionLock()
-
isRetry
@Deprecated public boolean isRetry()
Deprecated.will be removed in v0.3.3, please usegetRetry()insteadChecks whether retry is enabled or not.- Returns:
- true if retry is enabled; false otherwise
-
isReuseValueWrapper
public boolean isReuseValueWrapper()
-
hasServerInfo
public boolean hasServerInfo()
Checks whether we got all server information(e.g. timezone and version).- Returns:
- true if we got all server information; false otherwise
-
getServerTimeZone
public TimeZone getServerTimeZone()
-
getServerVersion
public ClickHouseVersion getServerVersion()
-
getSessionTimeout
public int getSessionTimeout()
-
isSessionCheck
public boolean isSessionCheck()
-
getSocketTimeout
public int getSocketTimeout()
-
isSsl
public boolean isSsl()
-
getSslMode
public ClickHouseSslMode getSslMode()
-
getSslRootCert
public String getSslRootCert()
-
getSslCert
public String getSslCert()
-
getSslKey
public String getSslKey()
-
getTransactionTimeout
public int getTransactionTimeout()
-
isUseBlockingQueue
public boolean isUseBlockingQueue()
-
isUseObjectsInArray
public boolean isUseObjectsInArray()
-
isUseNoProxy
public boolean isUseNoProxy()
-
isUseServerTimeZone
public boolean isUseServerTimeZone()
-
isUseServerTimeZoneForDates
public boolean isUseServerTimeZoneForDates()
-
getTimeZoneForDate
public TimeZone getTimeZoneForDate()
Gets time zone for date values.- Returns:
- time zone, could be null when
use_server_time_zone_for_dateis set tofalse.
-
getUseTimeZone
public TimeZone getUseTimeZone()
Gets preferred time zone. WhenisUseServerTimeZone()istrue, this returns same time zone asgetServerTimeZone().- Returns:
- non-null preferred time zone
-
getDefaultCredentials
public ClickHouseCredentials getDefaultCredentials()
-
getNodeSelector
public ClickHouseNodeSelector getNodeSelector()
-
getPreferredProtocols
public List<ClickHouseProtocol> getPreferredProtocols()
-
getAllOptions
public Map<ClickHouseOption,Serializable> getAllOptions()
-
getOption
public Serializable getOption(ClickHouseOption option)
-
getOption
public Serializable getOption(ClickHouseOption option, ClickHouseConfig defaultConfig)
-
getOption
public Serializable getOption(ClickHouseOption option, ClickHouseDefaults defaultValue)
-
hasOption
public boolean hasOption(ClickHouseOption option)
Test whether a given option is configured or not.- Parameters:
option- option to test- Returns:
- true if the option is configured; false otherwise
-
-