@@ -178,32 +178,60 @@ public static final class Builder {
178178 // The request router
179179 private Router <Void , Endpoint > router ;
180180
181+ /**
182+ * Create a new builder with the given endpoints and database.
183+ *
184+ * @param endpoints the endpoints to connect to
185+ * @param database The target database name. Default is "public". When a database name is provided,
186+ * the DB will attempt to parse catalog and schema from it. The format is
187+ * {@code [<catalog>-]<schema>}, where:
188+ * <ul>
189+ * <li>If {@code [<catalog>-]} is not provided, the entire database name is used as schema</li>
190+ * <li>If {@code [<catalog>-]} is provided, the name is split on "-" into catalog and schema</li>
191+ * </ul>
192+ */
181193 public Builder (List <Endpoint > endpoints , String database ) {
182194 this .endpoints .addAll (endpoints );
183195 this .database = database ;
184196 }
185197
186198 /**
187- * Asynchronous thread pool, which is used to handle various asynchronous
188- * tasks in the SDK (You are using a purely asynchronous SDK). If you do not
189- * set it, there will be a default implementation, which you can reconfigure
190- * if the default implementation is not satisfied.
191- * <p>
192- * Note: We do not close it to free resources(if it needs to be closed), as we
193- * view it as shared.
194- *
195- * @param asyncPool async thread pool
199+ * Sets the asynchronous thread pool used to handle various asynchronous tasks in the SDK.
200+ * This SDK is purely asynchronous. If not set, a default implementation will be used.
201+ * It's generally recommended to use the default configuration.
202+ *
203+ * <p>Default: {@link io.greptime.common.util.SerializingExecutor} - This executor does not start any additional threads,
204+ * it only uses the current thread to batch process small tasks.
205+ *
206+ * <p>Note: The SDK treats the thread pool as a shared resource and will not actively close it
207+ * to release resources (even if it needs to be closed).
208+ *
209+ * @param asyncPool the asynchronous thread pool to use
196210 * @return this builder
211+ * @see io.greptime.common.util.SerializingExecutor
197212 */
198213 public Builder asyncPool (Executor asyncPool ) {
199214 this .asyncPool = asyncPool ;
200215 return this ;
201216 }
202217
203218 /**
204- * Sets the RPC options, in general, the default configuration is fine.
219+ * Sets the RPC options. In general, the default configuration is fine.
220+ *
221+ * <p>This configuration only applies to Regular API, not to Bulk API.
205222 *
206- * @param rpcOptions the rpc options
223+ * <p>Key parameters include:
224+ * <ul>
225+ * <li>useRpcSharedPool: Whether to use global RPC shared pool (default: false)</li>
226+ * <li>defaultRpcTimeout: RPC request timeout (default: 60000ms)</li>
227+ * <li>maxInboundMessageSize: Maximum inbound message size (default: 256MB)</li>
228+ * <li>flowControlWindow: Flow control window size (default: 256MB)</li>
229+ * <li>idleTimeoutSeconds: Idle timeout duration (default: 5 minutes)</li>
230+ * <li>keepAliveTimeSeconds: Keep-alive ping interval (default: disabled)</li>
231+ * <li>limitKind: gRPC layer concurrency limit algorithm (default: None)</li>
232+ * </ul>
233+ *
234+ * @param rpcOptions the RPC options
207235 * @return this builder
208236 */
209237 public Builder rpcOptions (RpcOptions rpcOptions ) {
@@ -215,7 +243,15 @@ public Builder rpcOptions(RpcOptions rpcOptions) {
215243 * Set `TlsOptions` to use secure connection between client and server. Set to `null` to use
216244 * plaintext connection instead.
217245 *
218- * @param tlsOptions for configure secure connection, set to null to use plaintext
246+ * <p>Key parameters include:
247+ * <ul>
248+ * <li>clientCertChain: Client certificate chain file</li>
249+ * <li>privateKey: Private key file</li>
250+ * <li>privateKeyPassword: Private key password</li>
251+ * <li>rootCerts: Root certificate file</li>
252+ * </ul>
253+ *
254+ * @param tlsOptions TLS options for secure connection configuration, set to null to use plaintext
219255 * @return this builder
220256 */
221257 public Builder tlsOptions (TlsOptions tlsOptions ) {
@@ -224,9 +260,14 @@ public Builder tlsOptions(TlsOptions tlsOptions) {
224260 }
225261
226262 /**
227- * In some case of failure, a retry of write can be attempted.
263+ * Maximum number of retries for write failures. Whether to retry depends on the error type
264+ * {@link io.greptime.Status#isShouldRetry()}.
265+ *
266+ * <p>This configuration only applies to Regular API, not to Bulk API.
228267 *
229- * @param maxRetries max retries times
268+ * <p>Default: 1
269+ *
270+ * @param maxRetries the maximum number of retry attempts
230271 * @return this builder
231272 */
232273 public Builder writeMaxRetries (int maxRetries ) {
@@ -237,7 +278,11 @@ public Builder writeMaxRetries(int maxRetries) {
237278 /**
238279 * Write flow limit: maximum number of data points in-flight.
239280 *
240- * @param maxInFlightWritePoints max in-flight points
281+ * <p>This configuration only applies to Regular API, not to Bulk API.
282+ *
283+ * <p>Default: 655360 (10 * 65536)
284+ *
285+ * @param maxInFlightWritePoints the maximum number of in-flight write points
241286 * @return this builder
242287 */
243288 public Builder maxInFlightWritePoints (int maxInFlightWritePoints ) {
@@ -247,15 +292,21 @@ public Builder maxInFlightWritePoints(int maxInFlightWritePoints) {
247292
248293 /**
249294 * Write flow limit: the policy to use when the write flow limit is exceeded.
250- * The options:
251- * - `LimitedPolicy.DiscardPolicy`: discard the data if the limiter is full.
252- * - `LimitedPolicy.AbortPolicy`: abort if the limiter is full.
253- * - `LimitedPolicy.BlockingPolicy`: blocks if the limiter is full.
254- * - `LimitedPolicy.AbortOnBlockingTimeoutPolicy`: blocks the specified time if
255- * the limiter is full, abort if timeout.
256- * The default is `LimitedPolicy.AbortOnBlockingTimeoutPolicy`
257- *
258- * @param writeLimitedPolicy write limited policy
295+ *
296+ * <p>This configuration only applies to Regular API, not to Bulk API.
297+ *
298+ * <p>Available policies:
299+ * <ul>
300+ * <li>{@code DiscardPolicy}: Discard data if limiter is full</li>
301+ * <li>{@code AbortPolicy}: Abort if limiter is full, throw exception</li>
302+ * <li>{@code BlockingPolicy}: Block the write thread if limiter is full</li>
303+ * <li>{@code BlockingTimeoutPolicy}: Block for specified time then proceed if limiter is full</li>
304+ * <li>{@code AbortOnBlockingTimeoutPolicy}: Block for specified time, abort and throw exception if timeout</li>
305+ * </ul>
306+ *
307+ * <p>Default: {@code AbortOnBlockingTimeoutPolicy} (3 seconds)
308+ *
309+ * @param writeLimitedPolicy the write flow control policy
259310 * @return this builder
260311 */
261312 public Builder writeLimitedPolicy (LimitedPolicy writeLimitedPolicy ) {
@@ -264,11 +315,14 @@ public Builder writeLimitedPolicy(LimitedPolicy writeLimitedPolicy) {
264315 }
265316
266317 /**
267- * The default rate limit value(points per second) for `StreamWriter`. It only takes
318+ * The default rate limit value (points per second) for `StreamWriter`. It only takes
268319 * effect when we do not specify the `maxPointsPerSecond` when creating a `StreamWriter`.
269- * The default is 10 * 65536
270320 *
271- * @param defaultStreamMaxWritePointsPerSecond default max write points per second
321+ * <p>This configuration only applies to Regular API, not to Bulk API.
322+ *
323+ * <p>Default: 655360 (10 * 65536)
324+ *
325+ * @param defaultStreamMaxWritePointsPerSecond the default maximum write points per second for StreamWriter
272326 * @return this builder
273327 */
274328 public Builder defaultStreamMaxWritePointsPerSecond (int defaultStreamMaxWritePointsPerSecond ) {
@@ -277,9 +331,13 @@ public Builder defaultStreamMaxWritePointsPerSecond(int defaultStreamMaxWritePoi
277331 }
278332
279333 /**
280- * Use zero copy write in bulk write.
334+ * Whether to use zero- copy optimization in bulk write operations .
281335 *
282- * @param useZeroCopyWriteInBulkWrite use zero copy write in bulk write
336+ * <p>This configuration is effective for Bulk API.
337+ *
338+ * <p>Default: true
339+ *
340+ * @param useZeroCopyWriteInBulkWrite whether to use zero-copy write optimization in bulk operations
283341 * @return this builder
284342 */
285343 public Builder useZeroCopyWriteInBulkWrite (boolean useZeroCopyWriteInBulkWrite ) {
@@ -288,10 +346,12 @@ public Builder useZeroCopyWriteInBulkWrite(boolean useZeroCopyWriteInBulkWrite)
288346 }
289347
290348 /**
291- * Refresh frequency of route tables. The background refreshes all route tables
292- * periodically. By default, By default, the route tables will not be refreshed.
349+ * Background refresh period for route tables (seconds). The background refreshes all route tables
350+ * periodically. Route tables will not be refreshed if value is <= 0.
351+ *
352+ * <p>Default: 600 (10 minutes)
293353 *
294- * @param routeTableRefreshPeriodSeconds refresh period for route tables cache
354+ * @param routeTableRefreshPeriodSeconds the refresh period for route tables cache in seconds
295355 * @return this builder
296356 */
297357 public Builder routeTableRefreshPeriodSeconds (long routeTableRefreshPeriodSeconds ) {
@@ -300,11 +360,13 @@ public Builder routeTableRefreshPeriodSeconds(long routeTableRefreshPeriodSecond
300360 }
301361
302362 /**
303- * Timeout for health check. The default is 1000ms .
363+ * Timeout for health check operations (milliseconds) .
304364 * If the health check is not completed within the specified time, the health
305365 * check will fail.
306366 *
307- * @param checkHealthTimeoutMs timeout for health check
367+ * <p>Default: 1000 (1 second)
368+ *
369+ * @param checkHealthTimeoutMs the timeout for health check operations in milliseconds
308370 * @return this builder
309371 */
310372 public Builder checkHealthTimeoutMs (long checkHealthTimeoutMs ) {
@@ -313,10 +375,11 @@ public Builder checkHealthTimeoutMs(long checkHealthTimeoutMs) {
313375 }
314376
315377 /**
316- * Sets authentication information. If the DB is not required to authenticate,
317- * we can ignore this.
378+ * Sets database authentication information. Can be ignored if database doesn't require authentication.
379+ *
380+ * <p>Default: null
318381 *
319- * @param authInfo the authentication information
382+ * @param authInfo the database authentication information
320383 * @return this builder
321384 */
322385 public Builder authInfo (AuthInfo authInfo ) {
@@ -325,10 +388,12 @@ public Builder authInfo(AuthInfo authInfo) {
325388 }
326389
327390 /**
328- * Sets the request router. The internal default implementation works well.
329- * You don't need to set it unless you have special requirements.
391+ * Sets custom request router. The internal default implementation works well.
392+ * No need to set unless you have special requirements.
393+ *
394+ * <p>Default: Internal default implementation
330395 *
331- * @param router the request router
396+ * @param router the custom request router implementation
332397 * @return this builder
333398 */
334399 public Builder router (Router <Void , Endpoint > router ) {
0 commit comments