anuragp010 commented on code in PR #12112: URL: https://github.com/apache/ozone/pull/12112#discussion_r4663466290
########## hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/CreateFileOptions.java: ########## @@ -0,0 +1,93 @@ +/* + * 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.hadoop.ozone.client.protocol; + +import org.apache.hadoop.hdds.client.ReplicationConfig; + +/** + * Options for {@link ClientProtocol#createFile(String, String, String, CreateFileOptions)}. + * Encapsulates all optional parameters to allow future extensibility without adding a new overload for each of them. + */ +public final class CreateFileOptions { + + private final long size; + private final ReplicationConfig replicationConfig; + private final boolean overWrite; + private final boolean recursive; + + private CreateFileOptions(Builder b) { + this.size = b.size; + this.replicationConfig = b.replicationConfig; + this.overWrite = b.overWrite; + this.recursive = b.recursive; + } + + /** @return the size of the data to be written. */ + public long getSize() { + return size; + } + + /** @return the replication config, or null to use the bucket's default. */ + public ReplicationConfig getReplicationConfig() { Review Comment: Thanks @devmadhuu . Yes, without the null check we could get an error. I have added the null check in createFile(options). -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
