martin-sucha opened a new issue, #1786:
URL: https://github.com/apache/cassandra-gocql-driver/issues/1786

   There are use-cases for wrapping the executions of individual query attempts.
   
   We currently have QueryObserver and BatchObserver that allow observing the 
query attempts, but don't allow modification of behavior.
   
   One use case that requires modification of behavior is a request rate 
limiter (#1756) or a semaphore to limit request concurrency.
   
   It seems that instead of adding an individual interface for each use case, a 
single interceptor-like interface could serve all of them.
   
   The following `QueryAttemptInterceptor` could be used to implement the rate 
limiter, however we will need to make changes the interface to be able to 
replace the `QueryObserver` and `BatchObserver`:
   
   ```
   type QueryAttemptInterceptor interface {
       // AttemptQuery executes the query on the given connection.
       // The attempt function does the actual work, the AttempQuery 
implementation is free to execute code
       // before/after the call to the attempt function or skip the call 
altogether.
       // If error is nil, the returned *Iter must be non-nil.
       AttemptQuery(ctx context.Context, query ExecutableQuery, conn *Conn, 
attempt func(ctx context, query ExecutableQuery, conn *Conn) *Iter) (*Iter, 
error))
   }
   ```


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