absurdfarce commented on code in PR #2037:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2037#discussion_r2337922483


##########
core/src/main/java/com/datastax/oss/driver/api/core/tracker/RequestIdGenerator.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * 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 com.datastax.oss.driver.api.core.tracker;
+
+import com.datastax.oss.driver.api.core.cql.Statement;
+import com.datastax.oss.driver.api.core.session.Request;
+import 
com.datastax.oss.protocol.internal.util.collection.NullAllowingImmutableMap;
+import edu.umd.cs.findbugs.annotations.NonNull;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+/**
+ * Interface responsible for generating request IDs.
+ *
+ * <p>Note that all request IDs have a parent/child relationship. A "parent 
ID" can loosely be
+ * thought of as encompassing a sequence of a request + any attendant retries, 
speculative
+ * executions etc. It's scope is identical to that of a {@link
+ * com.datastax.oss.driver.internal.core.cql.CqlRequestHandler}. A "request 
ID" represents a single
+ * request within this larger scope. Note that a request corresponding to a 
request ID may be
+ * retried; in that case the retry count will be appended to the corresponding 
identifier in the
+ * logs.
+ */
+public interface RequestIdGenerator {
+  /**
+   * Generates a unique identifier for the session request. This will be the 
identifier for the
+   * entire `session.execute()` call. This identifier will be added to logs, 
and propagated to
+   * request trackers.
+   *
+   * @return a unique identifier for the session request
+   */
+  String getParentId();

Review Comment:
   A holdover question from the other PR: should we include a non-null Request 
here as well to keep the method calls consistent?  I didn't do so since none of 
the current impls require such a parameter and it isn't immediately obvious to 
me that it's something that future impls might want to leverage.  I don't want 
to add parameters just because somebody _might_ need them _someday_.  If we 
have a reasonable use case to suggest that there's something in the request 
other implementors might be interested in we can talk about that... but without 
a pretty clear idea there my default is to keep it out.
   
   The other thing worth pointing out: if we're wrong and we start seeing lots 
of RequestIdGenerator impls in the wild we can always ask the community for 
feedback and/or expand the API.  But I'd rather start with the minimal set of 
params we _know_ we need right now and expand that set if there's a case to do 
so.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to