Package io.milvus.param
Class ConnectParam.Builder
- java.lang.Object
-
- io.milvus.param.ConnectParam.Builder
-
- Direct Known Subclasses:
MultiConnectParam.Builder
- Enclosing class:
- ConnectParam
public static class ConnectParam.Builder extends Object
Builder forConnectParam
-
-
Field Summary
Fields Modifier and Type Field Description protected booleansecure
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConnectParambuild()Verifies parameters and creates a newConnectParaminstance.StringgetAuthorization()StringgetCaPemPath()StringgetClientKeyPath()StringgetClientPemPath()ThreadLocal<String>getClientRequestId()longgetConnectTimeoutMs()StringgetDatabaseName()StringgetHost()longgetIdleTimeoutMs()longgetKeepAliveTimeMs()longgetKeepAliveTimeoutMs()intgetPort()StringgetProxyAddress()longgetRpcDeadlineMs()StringgetServerName()StringgetServerPemPath()StringgetToken()StringgetUri()StringgetUserName()booleanisKeepAliveWithoutCalls()booleanisSecure()ConnectParam.BuilderkeepAliveWithoutCalls(boolean enable)Enables the keep-alive function for client channel.ConnectParam.Buildersecure(boolean enable)Deprecated.protected voidverify()ConnectParam.BuilderwithAuthorization(String authorization)Sets the authorization for this connectionConnectParam.BuilderwithAuthorization(String username, String password)Sets the username and password for this connectionConnectParam.BuilderwithCaPemPath(String caPemPath)Set the ca.pem path for tls two-way authentication, only takes effect when "secure" is True.ConnectParam.BuilderwithClientKeyPath(String clientKeyPath)Set the client.key path for tls two-way authentication, only takes effect when "secure" is True.ConnectParam.BuilderwithClientPemPath(String clientPemPath)Set the client.pem path for tls two-way authentication, only takes effect when "secure" is True.ConnectParam.BuilderwithClientRequestId(ThreadLocal<String> clientRequestId)ConnectParam.BuilderwithConnectTimeout(long connectTimeout, TimeUnit timeUnit)Sets the connection timeout value of client channel.ConnectParam.BuilderwithDatabaseName(String databaseName)Sets the database name.ConnectParam.BuilderwithHost(String host)Sets the host name/address.ConnectParam.BuilderwithIdleTimeout(long idleTimeout, TimeUnit timeUnit)Sets the idle timeout value of client channel.ConnectParam.BuilderwithKeepAliveTime(long keepAliveTime, TimeUnit timeUnit)Sets the keep-alive time value of client channel.ConnectParam.BuilderwithKeepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)Sets the keep-alive timeout value of client channel.ConnectParam.BuilderwithPort(int port)Sets the connection port.ConnectParam.BuilderwithProxyAddress(String proxyAddress)Sets the proxy address for connections through a proxy server.ConnectParam.BuilderwithRpcDeadline(long deadline, TimeUnit timeUnit)Set a deadline for how long you are willing to wait for a reply from the server.ConnectParam.BuilderwithSecure(boolean secure)Deprecated.ConnectParam.BuilderwithServerName(String serverName)Set target name override for SSL host name checking, only takes effect when "secure" is True.ConnectParam.BuilderwithServerPemPath(String serverPemPath)Set the server.pem path for tls one-way authentication, only takes effect when "secure" is True.ConnectParam.BuilderwithToken(String token)Sets the tokenConnectParam.BuilderwithUri(String uri)Sets the uri
-
-
-
Method Detail
-
getHost
public String getHost()
-
getPort
public int getPort()
-
getDatabaseName
public String getDatabaseName()
-
getUri
public String getUri()
-
getToken
public String getToken()
-
getConnectTimeoutMs
public long getConnectTimeoutMs()
-
getKeepAliveTimeMs
public long getKeepAliveTimeMs()
-
getKeepAliveTimeoutMs
public long getKeepAliveTimeoutMs()
-
isKeepAliveWithoutCalls
public boolean isKeepAliveWithoutCalls()
-
getRpcDeadlineMs
public long getRpcDeadlineMs()
-
getClientKeyPath
public String getClientKeyPath()
-
getClientPemPath
public String getClientPemPath()
-
getCaPemPath
public String getCaPemPath()
-
getServerPemPath
public String getServerPemPath()
-
getServerName
public String getServerName()
-
isSecure
public boolean isSecure()
-
getIdleTimeoutMs
public long getIdleTimeoutMs()
-
getAuthorization
public String getAuthorization()
-
getUserName
public String getUserName()
-
getClientRequestId
public ThreadLocal<String> getClientRequestId()
-
getProxyAddress
public String getProxyAddress()
-
withHost
public ConnectParam.Builder withHost(String host)
Sets the host name/address.- Parameters:
host- host name/address- Returns:
Builder
-
withPort
public ConnectParam.Builder withPort(int port)
Sets the connection port. Port value must be greater than zero and less than 65536.- Parameters:
port- port value- Returns:
Builder
-
withDatabaseName
public ConnectParam.Builder withDatabaseName(String databaseName)
Sets the database name.- Parameters:
databaseName- databaseName- Returns:
Builder
-
withUri
public ConnectParam.Builder withUri(String uri)
Sets the uri- Parameters:
uri- the uri of Milvus instance- Returns:
Builder
-
withToken
public ConnectParam.Builder withToken(String token)
Sets the token- Parameters:
token- serving as the key for identification and authentication purposes.- Returns:
Builder
-
withConnectTimeout
public ConnectParam.Builder withConnectTimeout(long connectTimeout, TimeUnit timeUnit)
Sets the connection timeout value of client channel. The timeout value must be greater than zero.- Parameters:
connectTimeout- timeout valuetimeUnit- timeout unit- Returns:
Builder
-
withKeepAliveTime
public ConnectParam.Builder withKeepAliveTime(long keepAliveTime, TimeUnit timeUnit)
Sets the keep-alive time value of client channel. The keep-alive value must be greater than zero. Default is 10000 ms.- Parameters:
keepAliveTime- keep-alive valuetimeUnit- keep-alive unit- Returns:
Builder
-
withKeepAliveTimeout
public ConnectParam.Builder withKeepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)
Sets the keep-alive timeout value of client channel. The timeout value must be greater than zero. Default value is 5000 ms- Parameters:
keepAliveTimeout- timeout valuetimeUnit- timeout unit- Returns:
Builder
-
keepAliveWithoutCalls
public ConnectParam.Builder keepAliveWithoutCalls(boolean enable)
Enables the keep-alive function for client channel.- Parameters:
enable- true keep-alive- Returns:
Builder
-
secure
@Deprecated public ConnectParam.Builder secure(boolean enable)
Deprecated.Enables the secure for client channel.Deprecated from v2.3.6, this flag is auto-detected, no need to specify
- Parameters:
enable- true keep-alive- Returns:
Builder
-
withIdleTimeout
public ConnectParam.Builder withIdleTimeout(long idleTimeout, TimeUnit timeUnit)
Sets the idle timeout value of client channel. The timeout value must be larger than zero.- Parameters:
idleTimeout- timeout valuetimeUnit- timeout unit- Returns:
Builder
-
withRpcDeadline
public ConnectParam.Builder withRpcDeadline(long deadline, TimeUnit timeUnit)
Set a deadline for how long you are willing to wait for a reply from the server. With a deadline setting, the client will wait when encounter fast RPC fail caused by network fluctuations. The deadline value must be larger than or equal to zero. Default value is 0, deadline is disabled.- Parameters:
deadline- deadline valuetimeUnit- deadline unit- Returns:
Builder
-
withAuthorization
public ConnectParam.Builder withAuthorization(String username, String password)
Sets the username and password for this connection- Parameters:
username- current userpassword- password- Returns:
Builder
-
withSecure
@Deprecated public ConnectParam.Builder withSecure(boolean secure)
Deprecated.Sets secure the authorization for this connection, set to True to enable TLSDeprecated from v2.3.6, this flag is auto-detected, no need to specify
- Parameters:
secure- boolean- Returns:
Builder
-
withAuthorization
public ConnectParam.Builder withAuthorization(String authorization)
Sets the authorization for this connection- Parameters:
authorization- the encoded authorization info that has included the encoded username and password info- Returns:
Builder
-
withClientKeyPath
public ConnectParam.Builder withClientKeyPath(String clientKeyPath)
Set the client.key path for tls two-way authentication, only takes effect when "secure" is True.- Parameters:
clientKeyPath- path of client.key- Returns:
Builder
-
withClientPemPath
public ConnectParam.Builder withClientPemPath(String clientPemPath)
Set the client.pem path for tls two-way authentication, only takes effect when "secure" is True.- Parameters:
clientPemPath- path of client.pem- Returns:
Builder
-
withCaPemPath
public ConnectParam.Builder withCaPemPath(String caPemPath)
Set the ca.pem path for tls two-way authentication, only takes effect when "secure" is True.- Parameters:
caPemPath- path of ca.pem- Returns:
Builder
-
withServerPemPath
public ConnectParam.Builder withServerPemPath(String serverPemPath)
Set the server.pem path for tls one-way authentication, only takes effect when "secure" is True.- Parameters:
serverPemPath- path of server.pem- Returns:
Builder
-
withServerName
public ConnectParam.Builder withServerName(String serverName)
Set target name override for SSL host name checking, only takes effect when "secure" is True. Note: this value is passed to grpc.ssl_target_name_override- Parameters:
serverName- override name for SSL host- Returns:
Builder
-
withClientRequestId
public ConnectParam.Builder withClientRequestId(ThreadLocal<String> clientRequestId)
-
withProxyAddress
public ConnectParam.Builder withProxyAddress(String proxyAddress)
Sets the proxy address for connections through a proxy server.- Parameters:
proxyAddress- proxy server address in format "host:port"- Returns:
Builder
-
build
public ConnectParam build() throws ParamException
Verifies parameters and creates a newConnectParaminstance.- Returns:
ConnectParam- Throws:
ParamException
-
verify
protected void verify() throws ParamException- Throws:
ParamException
-
-