pkuwm commented on a change in pull request #744: [WIP] Add read endpoints of metadata store directory service to helix rest URL: https://github.com/apache/helix/pull/744#discussion_r377425791
########## File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/zookeeper/MetadataStoreDirectoryAccessor.java ########## @@ -0,0 +1,123 @@ +package org.apache.helix.rest.server.resources.zookeeper; + +/* + * 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. + */ + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; + +import com.google.common.collect.ImmutableMap; +import org.apache.helix.rest.common.ContextPropertyKeys; +import org.apache.helix.rest.common.HelixRestNamespace; +import org.apache.helix.rest.metadatastore.MetadataStoreDirectory; +import org.apache.helix.rest.metadatastore.ZkMetadataStoreDirectory; +import org.apache.helix.rest.metadatastore.exceptions.InvalidRoutingDataException; +import org.apache.helix.rest.server.resources.AbstractResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Provides REST endpoints for accessing metadata store directory service, + * which responds to read/write requests of metadata store realms, sharding keys, etc.. + */ +@Path("") +public class MetadataStoreDirectoryAccessor extends AbstractResource { + private static final Logger LOG = LoggerFactory.getLogger(MetadataStoreDirectoryAccessor.class); + + private static final String METADATA_STORE_REALMS_NAME = "metadataStoreRealms"; + private static final String SHARDING_KEYS_NAME = "shardingKeys"; + + private final HelixRestNamespace _namespace = + (HelixRestNamespace) _application.getProperties().get(ContextPropertyKeys.METADATA.name()); + + private MetadataStoreDirectory _metadataStoreDirectory; + + @GET + @Path("/metadata-store-realms") Review comment: There are at least 2 naming conventions for helix-rest: ``` all lowercase: "/clusters/{clusterName}/instances/{instanceName}/healthreports" camelCase: "/clusters/{clusterName}/propertyStore/{path}" ``` There are a lot of comparisons for naming conventions in rest api. I personally like `spinal-case` because: - it feels right for URLs: URLs are case sensitive, best practice is to use lower case wherever possible - has better readability than camelCase, especially for a long URI. - camelCase is ineffective in contexts which are not case sensitive etc.. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
