@@ -178,30 +178,58 @@ 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 async 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.
222+ *
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>
205233 *
206234 * @param rpcOptions the rpc options
207235 * @return this builder
@@ -215,6 +243,14 @@ 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 *
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+ *
218254 * @param tlsOptions for configure secure connection, set to null to use plaintext
219255 * @return this builder
220256 */
@@ -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()}.
228265 *
229- * @param maxRetries max retries times
266+ * <p>This configuration only applies to Regular API, not to Bulk API.
267+ *
268+ * <p>Default: 1
269+ *
270+ * @param maxRetries maximum number of retry attempts
230271 * @return this builder
231272 */
232273 public Builder writeMaxRetries (int maxRetries ) {
@@ -237,6 +278,10 @@ public Builder writeMaxRetries(int maxRetries) {
237278 /**
238279 * Write flow limit: maximum number of data points in-flight.
239280 *
281+ * <p>This configuration only applies to Regular API, not to Bulk API.
282+ *
283+ * <p>Default: 655360 (10 * 65536)
284+ *
240285 * @param maxInFlightWritePoints max in-flight points
241286 * @return this builder
242287 */
@@ -247,13 +292,19 @@ 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`
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)
257308 *
258309 * @param writeLimitedPolicy write limited policy
259310 * @return this builder
@@ -264,9 +315,12 @@ 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
320+ *
321+ * <p>This configuration only applies to Regular API, not to Bulk API.
322+ *
323+ * <p>Default: 655360 (10 * 65536)
270324 *
271325 * @param defaultStreamMaxWritePointsPerSecond default max write points per second
272326 * @return this builder
@@ -277,7 +331,11 @@ 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.
335+ *
336+ * <p>This configuration is effective for Bulk API.
337+ *
338+ * <p>Default: true
281339 *
282340 * @param useZeroCopyWriteInBulkWrite use zero copy write in bulk write
283341 * @return this builder
@@ -288,8 +346,10 @@ 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 *
294354 * @param routeTableRefreshPeriodSeconds refresh period for route tables cache
295355 * @return this builder
@@ -300,10 +360,12 @@ 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 *
367+ * <p>Default: 1000 (1 second)
368+ *
307369 * @param checkHealthTimeoutMs timeout for health check
308370 * @return this builder
309371 */
@@ -313,8 +375,9 @@ 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 *
319382 * @param authInfo the authentication information
320383 * @return this builder
@@ -325,8 +388,10 @@ 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 *
331396 * @param router the request router
332397 * @return this builder
0 commit comments