murblanc commented on a change in pull request #1684: URL: https://github.com/apache/lucene-solr/pull/1684#discussion_r482436534
########## File path: solr/core/src/java/org/apache/solr/cluster/placement/PropertyValue.java ########## @@ -0,0 +1,144 @@ +/* + * 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.solr.cluster.placement; + +/** + * <p>The value corresponding to a specific {@link PropertyKey}, in a specific context (e.g. property of a specific + * {@link Node} instance). The context is tracked in the {@link PropertyKey} using a {@link PropertyValueSource}. + * + * <p>Instances are obtained by first getting a key using {@link PropertyKeyFactory} then getting the corresponding + * {@link PropertyValue} using {@link PropertyValueFetcher}. + */ +public interface PropertyValue { + /** + * The property key used for retrieving this property value. + */ + PropertyKey getKey(); + + /** + * Instances are obtained by first getting a key using {@link PropertyKeyFactory#createCoreCountKey} then calling + * {@link PropertyValueFetcher#fetchProperties}, retrieving the appropriate {@link PropertyValue} from the returned map + * using the {@link PropertyKey} as key and finally casting it to {@link PropertyValue.CoresCount}. + */ + interface CoresCount extends PropertyValue { Review comment: I was thinking of getting rid of the `PropertyValue` interface and classes and adding an accessor to get the value from the `PropertyKey` directly. This accessor would necessarily be an `Optional`, and would return empty if the property keys were not fetched yet or if the corresponding value was not returned by the fetch (sysprop not defined for example). This would force defining subinterfaces of `PropertyKey` (currently these are opaque objects), it would free the caller from manipulation the fetch result map (the fetch function would be `void` and only work by side effect on the keys passed to it). ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org