This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Interface representing Request/Response headers. This is a common interface for all network | |
| * transports and each transport is expected to have its own implementation. | |
| * | |
| * @param <T> represents the actual transport header object of generic type T. | |
| */ | |
| public interface UberCallHeaders<T> { | |
| /** | |
| * Fetch value corresponding to the given key. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Generic interface to represent MethodInfo fo type <T>. Used to hold method info like url path, | |
| * call type etc. | |
| * | |
| * @param <T> | |
| */ | |
| public interface MethodInfo<T> { | |
| /** @return the methodInfo object as is. */ | |
| T getTransportMethodInfo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Grpc's implementation of {@link MethodInfo}. | |
| * | |
| * @param <ReqT> reqeust object of generic Type ReqT. | |
| * @param <RespT> response object of generic Type RespT. | |
| */ | |
| public class GrpcMethodInfo<ReqT, RespT> implements MethodInfo<MethodDescriptor> { | |
| private MethodDescriptor<ReqT, RespT> methodDescriptor; | |
| private MethodType methodType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class UberClientCall<ReqT, RespT> { | |
| @Nullable private ClientCall<ReqT, RespT> delegate; | |
| public UberClientCall() {} | |
| public UberClientCall(ClientCall<ReqT, RespT> delegate) { | |
| this.delegate = delegate; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A virtual connection to a conceptual endpoint, to perform RPCs. A channel is free to have zero or | |
| * many actual connections to the endpoint based on configuration, load, etc. A channel is also free | |
| * to determine which actual endpoints to use and may change it every RPC, permitting client-side | |
| * load balancing. Applications are generally expected to use stubs instead of calling this class | |
| * directly. | |
| * | |
| * <p>Every new request will return an instance of {@link UberClientCall} and all further | |
| * processing, monitoring, manipulations are done with the UberClientCall instance. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Call router interceptor which routes calls to corresponding transport adaptors. | |
| * | |
| * @param <ReqT> request msg of generic type ReqT. | |
| * @param <RespT> response msg of generic type RespT. | |
| * @param <T> methodInfo of generic type T. | |
| */ | |
| public class UberCallRouterInterceptor<ReqT, RespT, T> extends UberInterceptor<ReqT, RespT, T> { | |
| // Adaptors will the next in the chain of interceptors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Adaptor for Grpc which does all the translation from generic uber types to grpc entities and | |
| * places the call to a grpc ManagedChannel. This class manages multiple channels and routes new | |
| * calls based on host fetched from UberInternalCallOptions. | |
| */ | |
| public class UbergRPCAdaptor implements UberChannel { | |
| private static final Logger LOGGER = Logger.getLogger(UbergRPCAdaptor.class.getName()); | |
| // static variable singleInstance of type Singleton |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Adaptor for Grpc which does all the translation from generic uber types to grpc entities and | |
| * places the call to a grpc ManagedChannel. This class manages multiple channels and routes new | |
| * calls based on host fetched from UberInternalCallOptions. | |
| */ | |
| public class UbergRPCAdaptor implements UberChannel { | |
| private static final Logger LOGGER = Logger.getLogger(UbergRPCAdaptor.class.getName()); | |
| // static variable singleInstance of type Singleton |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Since every interceptor needs to register as listener to next in chain, and on getting notified | |
| * should notify previous listener in the chain. This class will be the new listener which holds | |
| * reference to previous listener and gets registered to next interceptor in the chain. | |
| * | |
| * @param <ReqT> request msg of generic type ReqT. | |
| * @param <RespT> response msg of generic type RespT. | |
| * @param <T> methodInfo of generic type T. | |
| */ | |
| public class InternalListener<ReqT, RespT, T> extends UberNetworkListener<RespT> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Public interface for Realtime clients, ramen and other clients to send and receive network | |
| * requests. Clients need to instantiate {@link UberNetworkingClient} once using singleton method | |
| * {@link #getInstance(List)} and then for new grpc calls, can call the following. | |
| * uberNetworkingClient.newCall(MethodInfo, UberInternalCallOptions) This will return an instance of | |
| * {@link UberClientCall} and any further interaction to the request will be done in via {@link | |
| * UberClientCall}. | |
| * | |
| * <p>For every new call, UberNetworkingClient will instantiate a new chain of {@link | |
| * UberInterceptor}s and attachs them to the {@link UbergRPCAdaptor} at the end. {@link |