ptupitsyn commented on code in PR #2128: URL: https://github.com/apache/ignite-3/pull/2128#discussion_r1213239130
########## modules/api/src/main/java/org/apache/ignite/table/DataStreamerOptions.java: ########## @@ -0,0 +1,176 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.table; + +/** + * Data streamer options. See {@link DataStreamerTarget} for more information. + */ +public class DataStreamerOptions { + /** Default options. */ + public static final DataStreamerOptions DEFAULT = builder().build(); + + private final int batchSize; + + private final int perNodeParallelOperations; + + private final int autoFlushFrequency; + + private final int retryLimit; + + /** + * Constructor. + * + * @param batchSize Batch size. + * @param perNodeParallelOperations Per node parallel operations. + * @param autoFlushFrequency Auto flush frequency. + * @param retryLimit Retry limit. + */ + private DataStreamerOptions(int batchSize, int perNodeParallelOperations, int autoFlushFrequency, int retryLimit) { + this.batchSize = batchSize; + this.perNodeParallelOperations = perNodeParallelOperations; + this.autoFlushFrequency = autoFlushFrequency; + this.retryLimit = retryLimit; + } + + /** + * Creates a new builder. + * + * @return Builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Gets the batch size (the number of entries that will be sent to the cluster in one network call). + * + * @return Batch size. + */ + public int batchSize() { + return batchSize; + } + + /** + * Gets the number of parallel operations per node (how many in-flight requests can be active for a given node). + * + * @return Per node parallel operations. + */ + public int perNodeParallelOperations() { + return perNodeParallelOperations; + } + + /** + * Gets the auto flush frequency, in milliseconds + * (the period of time after which the streamer will flush the per-node buffer even if it is not full). + * + * @return Auto flush frequency. + */ + public int autoFlushFrequency() { + return autoFlushFrequency; + } + + /** + * Gets the retry limit for a batch. If a batch fails to be sent to the cluster, the streamer will retry it a number of times. + * If all retries fail, the streamer will be aborted. + * + * @return Retry limit. + */ + public int retryLimit() { + return retryLimit; + } + + /** + * Builder. + */ + public static class Builder { + private int batchSize = 1000; + + private int perNodeParallelOperations = 4; + + private int autoFlushFrequency = 5000; + + private int retryLimit = 16; Review Comment: No, we can discuss here I guess? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
