noblepaul commented on a change in pull request #1720:
URL: https://github.com/apache/lucene-solr/pull/1720#discussion_r466859745



##########
File path: solr/solrj/src/java/org/apache/solr/common/util/RpcFactory.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.common.util;
+
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.CommonParams;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.function.Function;
+
+/**A factory that creates any type of RPC calls in Solr
+ * This is designed to create low level access to the RPC mechanism.
+ * This is agnostic of Solr documents or other internal concepts of Solr
+ * But it knows certain things
+ * a) how to locate a Solr core/replica
+ * b) basic HTTP access,
+ * c) serialization/deserialization is the responsibility of the code that is 
making a request
+ *
+ */
+public interface RpcFactory {
+
+    CallRouter createCallRouter();
+
+    HttpRpc createHttpRpc();
+
+
+    interface ResponseConsumer {
+        /**Allows this impl to add request params/http headers before the 
request is fired
+         */
+        default void setRpc(HttpRpc rpc){};
+
+        /**Process the response.
+         * Ensure that the whole stream is eaten up before this method returns
+         * The stream will be closed after the method returns
+         */
+        Object accept(InputStream is) throws IOException;
+    }
+
+    /**Provide the payload stream
+     *
+     */
+    interface InputSupplier {
+        void write(OutputStream os) throws IOException;

Review comment:
       Yes, this call directly  writes to the stream to the server. if there is 
an underlying failure, it results in  an `IOException`




----------------------------------------------------------------
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

Reply via email to