murblanc commented on a change in pull request #1684: URL: https://github.com/apache/lucene-solr/pull/1684#discussion_r467127445
########## File path: solr/core/src/java/org/apache/solr/cluster/placement/PlacementPlugin.java ########## @@ -0,0 +1,41 @@ +/* + * 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; + +/** + * Implemented by external plugins to control replica placement and movement on the search cluster (as well as other things + * such as cluster elasticity?) when cluster changes are required (initiated elsewhere, most likely following a Collection + * API call). + */ +public interface PlacementPlugin { Review comment: I see a few options for passing config to the plugin: - Pass the config map in the `computePlacement` call along with the rest of the parameters - Provide in one of the passed factories the ability of the plugin code to call back into Solr and get the config - Add a `configure` call on the plugin as you suggest (then the Solr infra decides when to call this method) - Pass the config when the plugin class is instantiated. This might be equivalent to passing it in the `computePlacement` method if a new plugin class instance is created for each new computation. So the real choice is do we create a new plugin class instance per placement computation or reuse a given one? Creating a new one for each call is likely a simpler programming model for the plugin developer, it can use class member variables freely and if it wants to keep some state it has to make it static... With a new instance per computation, there would be no notion of "configuration update". A separate call into the plugin as you suggest or passing the config in `computePlacement` is equivalent (and the latter likely easier to handle in plugin code). I'm tempted to pass the config with each call to `computePlacement` (assuming the saving of not passing it when the plugin doesn't need it are non measurable). I'm also tempted to make it `Map<String, String>` given it will (most likely?) come from XML and the plugin code would have to deal with what the config means anyway and what types to cast it to... ---------------------------------------------------------------- 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