UpdateTokenInterceptor

public class UpdateTokenInterceptor
extends Object implements ClientInterceptor

java.lang.Object
   ↳ com.android.tradefed.result.resultdb.UpdateTokenInterceptor


A gRPC client interceptor that handles ResultDB update tokens.

It attaches the current update token to outgoing requests and extracts any new update token from incoming response headers for specific RPCs.

Summary

Public constructors

UpdateTokenInterceptor(Supplier<String> tokenSupplier, Consumer<String> tokenConsumer, String updateTokenRpc)

Constructor for UpdateTokenInterceptor.

Public methods

<ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next)

Public constructors

UpdateTokenInterceptor

public UpdateTokenInterceptor (Supplier<String> tokenSupplier, 
                Consumer<String> tokenConsumer, 
                String updateTokenRpc)

Constructor for UpdateTokenInterceptor.

Parameters
tokenSupplier Supplier: A supplier to get the current update token.

tokenConsumer Consumer: A consumer to set the update token if a new one is received.

updateTokenRpc String: A list of RPC method names that may return an update token in headers.

Public methods

interceptCall

public ClientCall<ReqT, RespT> interceptCall (MethodDescriptor<ReqT, RespT> method, 
                CallOptions callOptions, 
                Channel next)

Parameters
method MethodDescriptor

callOptions CallOptions

next Channel

Returns
ClientCall<ReqT, RespT>