smengcl commented on a change in pull request #2417: URL: https://github.com/apache/ozone/pull/2417#discussion_r671474115
########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/FileSizeDistributionResponse.java ########## @@ -0,0 +1,72 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.hadoop.ozone.recon.ReconConstants; + +import java.util.Arrays; + +/** + * HTTP Response wrapped for a file size distribution request. + * 'dist': the array that stores the file size distribution for all keys + * under the request path. + * 'pathNotFound': invalid path request. + * 'typeNA': the path exists, but refers to a namespace type (key) that are not + * applicable to file size distribution request. + */ +public class FileSizeDistributionResponse { + + @JsonProperty("dist") Review comment: i.e. here. [Example](https://github.com/apache/ozone/blob/5eae0e0ecc476cdb77a5e3a921882681dd9ae81b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/MissingContainersResponse.java#L27-L31) ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/BasicResponse.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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP Response wrapped for a 'basic' request. + * 'type': the namespace the request path is on. + * 'bucket': Total number of buckets for volume, 0 for other types. + * 'dir': Total number of directories for a bucket or directory, 0 for others. + * 'key': Total number of keys for a bucket or directory, 0 for others. + * 'pathNotFound': set to true if request path is valid + */ +public class BasicResponse { + @JsonProperty("type") + private EntityType entityType; + + @JsonProperty("bucket") + private int totalBucket; + + @JsonProperty("dir") + private int totalDir; + + @JsonProperty("key") + private int totalKey; Review comment: `numTotalKey` ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/FileSizeDistributionResponse.java ########## @@ -0,0 +1,72 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.hadoop.ozone.recon.ReconConstants; + +import java.util.Arrays; + +/** + * HTTP Response wrapped for a file size distribution request. + * 'dist': the array that stores the file size distribution for all keys + * under the request path. + * 'pathNotFound': invalid path request. + * 'typeNA': the path exists, but refers to a namespace type (key) that are not + * applicable to file size distribution request. + */ +public class FileSizeDistributionResponse { + + @JsonProperty("dist") + private int[] fileSizeDist; Review comment: new line after this for clarity ```suggestion private int[] fileSizeDist; ``` ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/FileSizeDistributionResponse.java ########## @@ -0,0 +1,72 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.hadoop.ozone.recon.ReconConstants; + +import java.util.Arrays; + +/** + * HTTP Response wrapped for a file size distribution request. + * 'dist': the array that stores the file size distribution for all keys + * under the request path. + * 'pathNotFound': invalid path request. + * 'typeNA': the path exists, but refers to a namespace type (key) that are not + * applicable to file size distribution request. Review comment: Let's move this chunk of javadoc right ahead their respective `@JsonProperty`s. ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/DUResponse.java ########## @@ -0,0 +1,96 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * HTTP Response wrapped for Disk Usage requests. + * 'duData' encapsulates an instance for a subpath. + * 'count' is the number of subpaths under the request path. + * 'pathNotFound' set to true if path is invalid. + */ Review comment: same suggestion here as in FileSizeDistributionResponse.java ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/BasicResponse.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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP Response wrapped for a 'basic' request. + * 'type': the namespace the request path is on. + * 'bucket': Total number of buckets for volume, 0 for other types. + * 'dir': Total number of directories for a bucket or directory, 0 for others. + * 'key': Total number of keys for a bucket or directory, 0 for others. + * 'pathNotFound': set to true if request path is valid + */ +public class BasicResponse { + @JsonProperty("type") + private EntityType entityType; + + @JsonProperty("bucket") + private int totalBucket; + + @JsonProperty("dir") + private int totalDir; Review comment: `numTotalDir` ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/EntityType.java ########## @@ -0,0 +1,30 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +/** + * Enum class for namespace type. + */ +public enum EntityType { + VOLUME, + BUCKET, + DIRECTORY, + KEY, + INVALID, // if path is invalid Review comment: Does `UNKNOWN` EntityType sound better? ```suggestion UNKNOWN, // if path is invalid ``` ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/BasicResponse.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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP Response wrapped for a 'basic' request. + * 'type': the namespace the request path is on. + * 'bucket': Total number of buckets for volume, 0 for other types. + * 'dir': Total number of directories for a bucket or directory, 0 for others. + * 'key': Total number of keys for a bucket or directory, 0 for others. + * 'pathNotFound': set to true if request path is valid + */ +public class BasicResponse { + @JsonProperty("type") + private EntityType entityType; + + @JsonProperty("bucket") + private int totalBucket; Review comment: Use `numTotalBucket` ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/FileSizeDistributionResponse.java ########## @@ -0,0 +1,72 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.hadoop.ozone.recon.ReconConstants; + +import java.util.Arrays; + +/** + * HTTP Response wrapped for a file size distribution request. + * 'dist': the array that stores the file size distribution for all keys + * under the request path. + * 'pathNotFound': invalid path request. + * 'typeNA': the path exists, but refers to a namespace type (key) that are not + * applicable to file size distribution request. + */ +public class FileSizeDistributionResponse { + + @JsonProperty("dist") + private int[] fileSizeDist; + @JsonProperty("pathNotFound") + private boolean pathNotFound; Review comment: new line after this as well ```suggestion private boolean pathNotFound; ``` ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/BasicResponse.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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP Response wrapped for a 'basic' request. + * 'type': the namespace the request path is on. + * 'bucket': Total number of buckets for volume, 0 for other types. + * 'dir': Total number of directories for a bucket or directory, 0 for others. + * 'key': Total number of keys for a bucket or directory, 0 for others. + * 'pathNotFound': set to true if request path is valid + */ +public class BasicResponse { + @JsonProperty("type") + private EntityType entityType; + + @JsonProperty("bucket") + private int totalBucket; + + @JsonProperty("dir") + private int totalDir; + + @JsonProperty("key") + private int totalKey; + + @JsonProperty("pathNotFound") + private boolean pathNotFound; Review comment: An arguably better approach is to rename this to `status`, and change the type to an enum, such as `BasicResponseStatusType`. `PATH_NOT_FOUND` can then be one of the statuses. Just for reference: ``` public enum BasicResponseStatusType { OK, PATH_NOT_FOUND } ``` When reusing `BasicResponseStatusType` for other responses such as the ones below we can use more general name for this enum and add more fields to it. ########## File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/QuotaUsageResponse.java ########## @@ -0,0 +1,80 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api.types; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP Response wrapped for a quota usage request. + * 'allowed': the quota in bytes that the namespace allows. + * 'used': the quota that the namespace has consumed in bytes. + * 'pathNotFound': invalid path request. + * 'typeNA': the path exists, but refers to a namespace type (directory, key) + * that are not applicable to a quota usage request. Review comment: same here -- 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]
