joao-r-reis commented on code in PR #1943:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1943#discussion_r3623804803


##########
query_executor.go:
##########
@@ -69,16 +71,151 @@ type internalRequest interface {
 }
 
 type queryExecutor struct {
-       pool   *policyConnPool
-       policy HostSelectionPolicy
+       pool        *policyConnPool
+       policy      HostSelectionPolicy
+       interceptor ExecAttemptInterceptor
 }
 
-func (q *queryExecutor) attemptQuery(ctx context.Context, qry internalRequest, 
conn *Conn) *Iter {
+type OpType int
+
+const (
+       OpQuery OpType = iota
+       OpBatch
+)
+
+type ImmutableQuery interface {
+       Statement() string
+       Values() []interface{}
+}
+
+type immutableQuery struct {
+       query *Query
+}
+
+func (q *immutableQuery) Statement() string {
+       return q.query.stmt
+}
+
+func (q *immutableQuery) Values() []interface{} {
+       return q.query.values
+}
+
+type ImmutableBatch interface {
+       Type() BatchType
+       Entries() []BatchEntry
+       Cons() Consistency
+}
+
+type immutableBatch struct {
+       batch *Batch
+}
+
+func (b *immutableBatch) Type() BatchType {
+       return b.batch.Type
+}
+
+func (b *immutableBatch) Entries() []BatchEntry {
+       return b.batch.Entries
+}
+
+func (b *immutableBatch) Cons() Consistency {
+       return b.batch.Cons
+}
+
+type QueryAttempt struct {
+       // The op type, whether query or batch.
+       Type OpType
+       // Only one of Query or Batch will be set, depending on the op type.
+       Query ImmutableQuery
+       Batch ImmutableBatch
+       // The host that will receive the query.
+       Host *HostInfo
+       // The local address of the connection used to execute the query.
+       LocalAddr net.Addr
+       // The remote address of the connection used to execute the query.
+       RemoteAddr net.Addr
+       // The number of this query attempt. 0 for the initial attempt, 1 for 
the first retry, etc. Note that there may be multiple serial Attempts to 
different hosts within a single execution, whether main execution or 
speculative.
+       Attempts int
+       // The index of the speculative execution attempt this attempt is 
associated with, starting with index 1. -1 indicates this is the "main" 
execution.

Review Comment:
   Why -1 and not 0?



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