vrajat commented on code in PR #14110:
URL: https://github.com/apache/pinot/pull/14110#discussion_r1867785540


##########
pinot-spi/src/main/java/org/apache/pinot/spi/cursors/ResponseStore.java:
##########
@@ -0,0 +1,78 @@
+/**
+ * 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.pinot.spi.cursors;
+
+import java.util.Collection;
+
+
+/**
+ * ResponseStore stores responses organized by request id.
+ * Since @link{BrokerResponse} cannot be moved SPI package, some of the 
functions are declared in
+ * @link{AbstractResponseStore}
+ * <br/>
+ * Concurrency Model:
+ * <br/>
+ * There are 3 possible roles - writer, reader and delete.
+ * <br/>
+ * There can only be ONE writer and no other concurrent roles can execute.
+ * A query store is written during query execution. During execution, there 
can be no reads or deletes as the
+ * query id would not have been provided to the client.
+ * <br/>
+ * There can be multiple readers. There maybe concurrent deletes but no 
concurrent writes.
+ * Multiple clients can potentially iterate through the result set.
+ * <br/>
+ * There can be multiple deletes. There maybe concurrent reads but no 
concurrent writes.
+ * Multiple clients can potentially call the delete API.
+ * <br/>
+ * Implementations should ensure that concurrent read/delete and delete/delete 
operations are handled correctly.
+ */
+public interface ResponseStore {
+  /**
+   * Get the type of the ResponseStore
+   * @return Type of the store
+   */
+  String getType();
+
+  /**
+   * Checks if the response for a requestId exists.
+   * @param requestId The ID of the request
+   * @return True if response exists else false
+   * @throws Exception Thrown if an error occurs when checking if the response 
exists.
+   */
+  boolean exists(String requestId)
+    throws Exception;
+
+  /**
+   * Get all request ids of responses in the ResponseStore.
+   *
+   * @return List of request ids
+   */
+  Collection<String> getAllStoredRequestIds()
+      throws Exception;
+
+  /**
+   * Delete a response.
+   *
+   * @param requestId Request id of the query.
+   * @return True if response was found and deleted.

Review Comment:
   The inverse is implied ? The expectation is that any errors will throw an 
exception.



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

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to