You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/07/21 08:27:25 UTC

[GitHub] [lucene-solr] murblanc commented on a change in pull request #1684: SOLR-14613: strongly typed initial proposal for plugin interface

murblanc commented on a change in pull request #1684:
URL: https://github.com/apache/lucene-solr/pull/1684#discussion_r457925818



##########
File path: solr/core/src/java/org/apache/solr/cloud/gumi/Replica.java
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.cloud.gumi;
+
+/**
+ * An instantiation (or one of the copies) of a given {@link Shard} of a given {@link SolrCollection}.
+ * Objects of this type are returned by the Solr framework to the plugin, they are not built by the plugin. When the
+ * plugin wants to add a replica it goes through {@link WorkOrderFactory#createWorkOrderCreateReplica}).
+ * TODO is there an elegant way to have this type also used by the plugin to add replicas? (insisting on elegant)
+ */
+public interface Replica {

Review comment:
       Couple reasons not to use `org.apache.solr.common.cloud.Replica`:
   
   The abstraction level there is "weak". For example from a replica getting a shard returns a String with Shard name. The plugin can't do much with a String. We'd have to provide the plugin with a way to convert that String into data, adding complexity. It's easier to have a real object (interface) that can be used right away (in our case to get the index of the shard in the collection, possibly other data will be added as other use cases are inventoried).
   
   There are or might be things in this class (it's not even an interface) that the plugin doesn't need and shouldn't know about. No reason to expose those.
   
   Also, exposing an internal implementation class to external plugin code (code the community will not necessarily have access to) forces not to change that internal class to not risk breaking the external plugins. This might be a problem, it limits refactoring. By having an insulation layer (Adapter/Wrapper pattern) we can refactor `org.apache.solr.common.cloud.Replica` as much as we want, and will adapt the (internal) implementation provided for `org.apache.solr.cloud.gumi.Replica` so client plugin code is not impacted.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org