├── LICENSE ├── README.md ├── dorado ├── .gitignore ├── LICENSE ├── README.md ├── dorado-build │ └── pom.xml ├── dorado-common │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── meituan │ │ │ └── dorado │ │ │ └── common │ │ │ ├── Constants.java │ │ │ ├── Role.java │ │ │ ├── RpcRole.java │ │ │ ├── exception │ │ │ ├── ApplicationException.java │ │ │ ├── DegradeException.java │ │ │ ├── DoradoException.java │ │ │ ├── FilterException.java │ │ │ ├── ProtocolException.java │ │ │ ├── RegistryException.java │ │ │ ├── RemoteException.java │ │ │ ├── RpcException.java │ │ │ ├── ServiceException.java │ │ │ ├── TimeoutException.java │ │ │ └── TransportException.java │ │ │ ├── extension │ │ │ ├── ExtensionLoader.java │ │ │ └── SPI.java │ │ │ ├── thread │ │ │ ├── DefaultThreadFactory.java │ │ │ └── ExecutorUtil.java │ │ │ └── util │ │ │ ├── ClassLoaderUtil.java │ │ │ ├── CommonUtil.java │ │ │ ├── NetUtil.java │ │ │ ├── SizeUtil.java │ │ │ ├── URLUtil.java │ │ │ └── VersionUtil.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── meituan │ │ │ └── dorado │ │ │ └── common │ │ │ ├── extension │ │ │ ├── Extension.java │ │ │ ├── ExtensionLoaderTest.java │ │ │ ├── FirstExtension.java │ │ │ └── SecondExtension.java │ │ │ ├── thread │ │ │ ├── ExecutorUtilTest.java │ │ │ └── ThreadFactoryTest.java │ │ │ └── util │ │ │ ├── ClassLoaderUtilTest.java │ │ │ ├── CommonUtilTest.java │ │ │ ├── NetUtilTest.java │ │ │ ├── URLUtilTest.java │ │ │ └── VersionUtilTest.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.meituan.dorado.common.extension.Extension │ │ ├── dorado-application.properties │ │ └── log4j2.xml ├── dorado-core-default │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ ├── check │ │ │ │ └── http │ │ │ │ │ ├── DoradoHttpCheckHandler.java │ │ │ │ │ └── meta │ │ │ │ │ ├── HttpURI.java │ │ │ │ │ ├── PortServiceInfo.java │ │ │ │ │ ├── ProviderInfo.java │ │ │ │ │ └── ServiceMethodInfo.java │ │ │ │ ├── codec │ │ │ │ └── octo │ │ │ │ │ ├── DoradoCodec.java │ │ │ │ │ ├── MetaUtil.java │ │ │ │ │ └── OctoCodec.java │ │ │ │ ├── rpc │ │ │ │ └── handler │ │ │ │ │ ├── DoradoHandlerFactory.java │ │ │ │ │ ├── filter │ │ │ │ │ ├── AccessLogFilter.java │ │ │ │ │ ├── DoradoInvokerTraceFilter.java │ │ │ │ │ └── DoradoProviderTraceFilter.java │ │ │ │ │ ├── http │ │ │ │ │ └── DoradoHttpInvokeHandler.java │ │ │ │ │ ├── invoker │ │ │ │ │ ├── DoradoInvoker.java │ │ │ │ │ ├── DoradoInvokerFactory.java │ │ │ │ │ └── DoradoInvokerInvokeHandler.java │ │ │ │ │ └── provider │ │ │ │ │ ├── DoradoProviderInvokeHandler.java │ │ │ │ │ └── ScannerHeartBeatInvokeHandler.java │ │ │ │ ├── serialize │ │ │ │ ├── DoradoSerializerFactory.java │ │ │ │ └── thrift │ │ │ │ │ ├── ThriftAnnotationSerializer.java │ │ │ │ │ ├── ThriftCodecSerializer.java │ │ │ │ │ ├── ThriftIDLSerializer.java │ │ │ │ │ ├── ThriftMessageSerializer.java │ │ │ │ │ ├── ThriftUtil.java │ │ │ │ │ └── annotation │ │ │ │ │ ├── AbstractThriftException.java │ │ │ │ │ ├── ThriftAnnotationExtensionInitializer.java │ │ │ │ │ ├── ThriftAnnotationManager.java │ │ │ │ │ ├── codec │ │ │ │ │ ├── ThriftMethodCodec.java │ │ │ │ │ └── ThriftServiceCodec.java │ │ │ │ │ └── metadata │ │ │ │ │ ├── ThriftMethodMetadata.java │ │ │ │ │ └── ThriftServiceMetadata.java │ │ │ │ └── transport │ │ │ │ ├── DoradoLengthDecoder.java │ │ │ │ └── meta │ │ │ │ ├── DefaultRequest.java │ │ │ │ └── DefaultResponse.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ ├── com.meituan.dorado.bootstrap.ExtensionInitializer │ │ │ ├── com.meituan.dorado.check.http.HttpCheckHandler │ │ │ ├── com.meituan.dorado.cluster.Cluster │ │ │ ├── com.meituan.dorado.cluster.LoadBalance │ │ │ ├── com.meituan.dorado.cluster.Router │ │ │ ├── com.meituan.dorado.codec.Codec │ │ │ ├── com.meituan.dorado.rpc.handler.HandlerFactory │ │ │ ├── com.meituan.dorado.rpc.handler.HeartBeatInvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.InvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.filter.Filter │ │ │ ├── com.meituan.dorado.rpc.handler.http.HttpInvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.invoker.InvokerFactory │ │ │ ├── com.meituan.dorado.rpc.proxy.ProxyFactory │ │ │ └── com.meituan.dorado.transport.LengthDecoder │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── meituan │ │ │ └── dorado │ │ │ ├── HelloService.java │ │ │ ├── HelloServiceImpl.java │ │ │ ├── MockUtil.java │ │ │ ├── codec │ │ │ └── octo │ │ │ │ ├── DoradoCodecTest.java │ │ │ │ └── MetaUtilTest.java │ │ │ ├── mock │ │ │ ├── MockChannel.java │ │ │ ├── MockClient.java │ │ │ ├── MockClientFactory.java │ │ │ ├── MockCluster.java │ │ │ ├── MockCodec.java │ │ │ ├── MockErrorFilter.java │ │ │ ├── MockErrorInvoker.java │ │ │ ├── MockFilter.java │ │ │ ├── MockFilterHandler.java │ │ │ ├── MockHandlerFactory.java │ │ │ ├── MockHttpCheckHandler.java │ │ │ ├── MockHttpSender.java │ │ │ ├── MockHttpServer.java │ │ │ ├── MockHttpServerFactory.java │ │ │ ├── MockInvokeHandler.java │ │ │ ├── MockInvokeTrace.java │ │ │ ├── MockInvoker.java │ │ │ ├── MockInvokerFactory.java │ │ │ ├── MockInvokerFilter.java │ │ │ ├── MockInvokerTraceFilter.java │ │ │ ├── MockLoadBalance.java │ │ │ ├── MockProviderFilter.java │ │ │ ├── MockProviderTraceFilter.java │ │ │ ├── MockRegistry.java │ │ │ ├── MockRegistryFactory.java │ │ │ ├── MockRegistryPolicy.java │ │ │ ├── MockResponse.java │ │ │ ├── MockServer.java │ │ │ └── MockServerFactory.java │ │ │ ├── rpc │ │ │ └── handler │ │ │ │ ├── invoker │ │ │ │ └── DoradoInvokerTest.java │ │ │ │ └── provider │ │ │ │ ├── HeartBeatInvokeHandlerTest.java │ │ │ │ └── ProviderInvokeHandlerTest.java │ │ │ ├── serialize │ │ │ ├── DoradoSerializerFactoryTest.java │ │ │ └── thrift │ │ │ │ └── ThriftUtilTest.java │ │ │ └── transport │ │ │ └── DoradoLengthDecoderTest.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── com.meituan.dorado.check.http.HttpCheckHandler │ │ │ ├── com.meituan.dorado.cluster.Cluster │ │ │ ├── com.meituan.dorado.cluster.LoadBalance │ │ │ ├── com.meituan.dorado.cluster.Router │ │ │ ├── com.meituan.dorado.codec.Codec │ │ │ ├── com.meituan.dorado.rpc.handler.HandlerFactory │ │ │ ├── com.meituan.dorado.rpc.handler.HeartBeatInvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.InvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.filter.Filter │ │ │ ├── com.meituan.dorado.rpc.handler.filter.ServiceInvocationFilter │ │ │ ├── com.meituan.dorado.rpc.handler.http.HttpInvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.invoker.InvokerFactory │ │ │ ├── com.meituan.dorado.rpc.proxy.ProxyFactory │ │ │ ├── com.meituan.dorado.transport.ClientFactory │ │ │ └── com.meituan.dorado.transport.LengthDecoder │ │ └── log4j2.xml ├── dorado-core │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ ├── bootstrap │ │ │ │ ├── ExtensionInitializer.java │ │ │ │ ├── ServiceBootstrap.java │ │ │ │ ├── invoker │ │ │ │ │ ├── ServiceInvocationRepository.java │ │ │ │ │ └── ServiceSubscriber.java │ │ │ │ └── provider │ │ │ │ │ ├── ProviderInfoRepository.java │ │ │ │ │ ├── ServicePublisher.java │ │ │ │ │ └── meta │ │ │ │ │ ├── ProviderStatus.java │ │ │ │ │ ├── ServerInfo.java │ │ │ │ │ └── ServiceIfaceInfo.java │ │ │ │ ├── check │ │ │ │ └── http │ │ │ │ │ └── HttpCheckHandler.java │ │ │ │ ├── cluster │ │ │ │ ├── Cluster.java │ │ │ │ ├── ClusterHandler.java │ │ │ │ ├── InvokerRepository.java │ │ │ │ ├── LoadBalance.java │ │ │ │ ├── Router.java │ │ │ │ ├── loadbalance │ │ │ │ │ ├── AbstractLoadBalance.java │ │ │ │ │ ├── LoadBalanceFactory.java │ │ │ │ │ ├── RandomLoadBalance.java │ │ │ │ │ └── RoundRobinLoadBalance.java │ │ │ │ ├── router │ │ │ │ │ ├── NoneRouter.java │ │ │ │ │ └── RouterFactory.java │ │ │ │ └── tolerance │ │ │ │ │ ├── FailbackCluster.java │ │ │ │ │ ├── FailbackClusterHandler.java │ │ │ │ │ ├── FailfastCluster.java │ │ │ │ │ ├── FailfastClusterHandler.java │ │ │ │ │ ├── FailoverCluster.java │ │ │ │ │ └── FailoverClusterHandler.java │ │ │ │ ├── codec │ │ │ │ └── Codec.java │ │ │ │ ├── config │ │ │ │ └── service │ │ │ │ │ ├── AbstractConfig.java │ │ │ │ │ ├── ClientConfig.java │ │ │ │ │ ├── ProviderConfig.java │ │ │ │ │ ├── ReferenceConfig.java │ │ │ │ │ ├── ServiceConfig.java │ │ │ │ │ ├── spring │ │ │ │ │ ├── ReferenceBean.java │ │ │ │ │ └── ServiceBean.java │ │ │ │ │ └── util │ │ │ │ │ └── CallWayEnum.java │ │ │ │ ├── degrade │ │ │ │ └── NodeDegrade.java │ │ │ │ ├── registry │ │ │ │ ├── DiscoveryService.java │ │ │ │ ├── ProviderListener.java │ │ │ │ ├── Registry.java │ │ │ │ ├── RegistryFactory.java │ │ │ │ ├── RegistryPolicy.java │ │ │ │ ├── RegistryService.java │ │ │ │ ├── meta │ │ │ │ │ ├── Provider.java │ │ │ │ │ ├── RegistryInfo.java │ │ │ │ │ └── SubscribeInfo.java │ │ │ │ └── support │ │ │ │ │ ├── AbstractRegistryFactory.java │ │ │ │ │ └── FailbackRegistry.java │ │ │ │ ├── rpc │ │ │ │ ├── AsyncContext.java │ │ │ │ ├── DefaultFuture.java │ │ │ │ ├── ResponseCallback.java │ │ │ │ ├── ResponseFuture.java │ │ │ │ ├── handler │ │ │ │ │ ├── AbstractHandlerFactory.java │ │ │ │ │ ├── HandlerFactory.java │ │ │ │ │ ├── HeartBeatInvokeHandler.java │ │ │ │ │ ├── InvokeHandler.java │ │ │ │ │ ├── filter │ │ │ │ │ │ ├── AbstractTraceFilter.java │ │ │ │ │ │ ├── Filter.java │ │ │ │ │ │ ├── FilterHandler.java │ │ │ │ │ │ └── InvokeChainBuilder.java │ │ │ │ │ ├── http │ │ │ │ │ │ ├── DefaultHttpResponse.java │ │ │ │ │ │ ├── HttpHandler.java │ │ │ │ │ │ └── HttpInvokeHandler.java │ │ │ │ │ ├── invoker │ │ │ │ │ │ ├── AbstractInvoker.java │ │ │ │ │ │ ├── AbstractInvokerFilter.java │ │ │ │ │ │ ├── AbstractInvokerInvokeHandler.java │ │ │ │ │ │ ├── AbstractInvokerTraceFilter.java │ │ │ │ │ │ ├── Invoker.java │ │ │ │ │ │ └── InvokerFactory.java │ │ │ │ │ └── provider │ │ │ │ │ │ ├── AbstractProviderFilter.java │ │ │ │ │ │ ├── AbstractProviderInvokeHandler.java │ │ │ │ │ │ └── AbstractProviderTraceFilter.java │ │ │ │ ├── meta │ │ │ │ │ ├── RpcInvocation.java │ │ │ │ │ └── RpcResult.java │ │ │ │ └── proxy │ │ │ │ │ ├── DefaultInvocationHandler.java │ │ │ │ │ ├── ProxyFactory.java │ │ │ │ │ └── jdk │ │ │ │ │ └── JdkProxyFactory.java │ │ │ │ ├── serialize │ │ │ │ ├── Serializer.java │ │ │ │ ├── protostuff │ │ │ │ │ └── ProtostuffSerializer.java │ │ │ │ └── thrift │ │ │ │ │ └── ThriftSerializer.java │ │ │ │ ├── trace │ │ │ │ ├── AbstractInvokeTrace.java │ │ │ │ ├── InvokeTrace.java │ │ │ │ ├── InvokerAsyncTrace.java │ │ │ │ ├── TraceFactory.java │ │ │ │ └── meta │ │ │ │ │ ├── TraceParam.java │ │ │ │ │ ├── TraceStatus.java │ │ │ │ │ ├── TraceTimeline.java │ │ │ │ │ └── TransportTraceInfo.java │ │ │ │ ├── transport │ │ │ │ ├── AbstractChannel.java │ │ │ │ ├── AbstractClient.java │ │ │ │ ├── AbstractClientFactory.java │ │ │ │ ├── AbstractServer.java │ │ │ │ ├── Channel.java │ │ │ │ ├── ChannelHandler.java │ │ │ │ ├── Client.java │ │ │ │ ├── ClientFactory.java │ │ │ │ ├── LengthDecoder.java │ │ │ │ ├── Server.java │ │ │ │ ├── ServerFactory.java │ │ │ │ ├── http │ │ │ │ │ ├── AbstractHttpServer.java │ │ │ │ │ ├── HttpSender.java │ │ │ │ │ ├── HttpServer.java │ │ │ │ │ └── HttpServerFactory.java │ │ │ │ ├── meta │ │ │ │ │ ├── Request.java │ │ │ │ │ └── Response.java │ │ │ │ └── support │ │ │ │ │ ├── InvokerChannelHandler.java │ │ │ │ │ └── ProviderChannelHandler.java │ │ │ │ └── util │ │ │ │ ├── BytesUtil.java │ │ │ │ ├── ChecksumUtil.java │ │ │ │ ├── ClazzUtil.java │ │ │ │ ├── CompressUtil.java │ │ │ │ └── MethodUtil.java │ │ └── resources │ │ │ └── dorado-application.properties │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── meituan │ │ │ └── dorado │ │ │ ├── HelloService.java │ │ │ ├── HelloServiceImpl.java │ │ │ ├── MockUtil.java │ │ │ ├── bootstrap │ │ │ ├── ServiceBootstrapTest.java │ │ │ ├── invoker │ │ │ │ ├── ServiceInvocationRepositoryTest.java │ │ │ │ └── ServiceSubscriberTest.java │ │ │ └── provider │ │ │ │ └── ServicePublisherTest.java │ │ │ ├── cluster │ │ │ ├── ClusterHandlerTest.java │ │ │ ├── InvokerRepositoryTest.java │ │ │ ├── loadbalance │ │ │ │ ├── LoadBalanceFactoryTest.java │ │ │ │ └── LoadBalanceTest.java │ │ │ ├── router │ │ │ │ ├── RouteTest.java │ │ │ │ └── RouterFactoryTest.java │ │ │ └── tolerance │ │ │ │ └── ClusterTest.java │ │ │ ├── config │ │ │ └── service │ │ │ │ ├── ConfigTest.java │ │ │ │ └── spring │ │ │ │ └── SpringBeanTest.java │ │ │ ├── degrade │ │ │ └── NodeDegradeTest.java │ │ │ ├── mock │ │ │ ├── MockChannel.java │ │ │ ├── MockClient.java │ │ │ ├── MockClientFactory.java │ │ │ ├── MockCluster.java │ │ │ ├── MockCodec.java │ │ │ ├── MockErrorFilter.java │ │ │ ├── MockErrorInvoker.java │ │ │ ├── MockFilter.java │ │ │ ├── MockFilterHandler.java │ │ │ ├── MockHandlerFactory.java │ │ │ ├── MockHttpCheckHandler.java │ │ │ ├── MockHttpServer.java │ │ │ ├── MockHttpServerFactory.java │ │ │ ├── MockInvokeHandler.java │ │ │ ├── MockInvokeTrace.java │ │ │ ├── MockInvoker.java │ │ │ ├── MockInvokerFactory.java │ │ │ ├── MockInvokerFilter.java │ │ │ ├── MockInvokerTraceFilter.java │ │ │ ├── MockLoadBalance.java │ │ │ ├── MockProviderFilter.java │ │ │ ├── MockProviderTraceFilter.java │ │ │ ├── MockRegistry.java │ │ │ ├── MockRegistryFactory.java │ │ │ ├── MockRegistryPolicy.java │ │ │ ├── MockRequest.java │ │ │ ├── MockResponse.java │ │ │ ├── MockServer.java │ │ │ └── MockServerFactory.java │ │ │ ├── registry │ │ │ ├── RegistryPolicyTest.java │ │ │ ├── meta │ │ │ │ └── RegistryInfoTest.java │ │ │ └── support │ │ │ │ └── FailbackRegistryTest.java │ │ │ ├── rpc │ │ │ ├── AsyncContextTest.java │ │ │ ├── DefaultFutureTest.java │ │ │ ├── handler │ │ │ │ ├── AbstractHandlerFactoryTest.java │ │ │ │ ├── filter │ │ │ │ │ ├── ClientQpsLimitFilter.java │ │ │ │ │ ├── CustomFilter1.java │ │ │ │ │ ├── CustomFilter2.java │ │ │ │ │ ├── FilterTest.java │ │ │ │ │ ├── InvokerFilter.java │ │ │ │ │ ├── ProviderFilter.java │ │ │ │ │ ├── ServerQpsLimitFilter.java │ │ │ │ │ ├── SpecificFilter.java │ │ │ │ │ └── TraceTestFilter.java │ │ │ │ └── invoker │ │ │ │ │ └── AbstractInvokerTest.java │ │ │ └── proxy │ │ │ │ └── jdk │ │ │ │ └── JdkProxyFactoryTest.java │ │ │ ├── transport │ │ │ ├── TransportTest.java │ │ │ └── http │ │ │ │ └── HttpServerTest.java │ │ │ └── util │ │ │ ├── BytesUtilTest.java │ │ │ ├── ChecksumUtilTest.java │ │ │ ├── CompressUtilTest.java │ │ │ └── MethodUtilTest.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── com.meituan.dorado.check.http.HttpCheckHandler │ │ │ ├── com.meituan.dorado.cluster.Cluster │ │ │ ├── com.meituan.dorado.cluster.LoadBalance │ │ │ ├── com.meituan.dorado.cluster.Router │ │ │ ├── com.meituan.dorado.codec.Codec │ │ │ ├── com.meituan.dorado.registry.RegistryFactory │ │ │ ├── com.meituan.dorado.rpc.handler.HandlerFactory │ │ │ ├── com.meituan.dorado.rpc.handler.InvokeHandler │ │ │ ├── com.meituan.dorado.rpc.handler.filter.Filter │ │ │ ├── com.meituan.dorado.rpc.handler.invoker.InvokerFactory │ │ │ ├── com.meituan.dorado.rpc.proxy.ProxyFactory │ │ │ ├── com.meituan.dorado.trace.InvokeTrace │ │ │ ├── com.meituan.dorado.transport.ClientFactory │ │ │ ├── com.meituan.dorado.transport.ServerFactory │ │ │ └── com.meituan.dorado.transport.http.HttpServerFactory │ │ └── log4j2.xml ├── dorado-demo │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── meituan │ │ │ └── dorado │ │ │ └── demo │ │ │ ├── ConsoleCommandProcessor.java │ │ │ ├── QuitOperation.java │ │ │ └── thrift │ │ │ ├── annotation │ │ │ ├── TestRequest.java │ │ │ ├── TestResponse.java │ │ │ ├── TestService.java │ │ │ ├── TestServiceImpl.java │ │ │ ├── ThriftConsumer.java │ │ │ └── ThriftProvider.java │ │ │ ├── apiway │ │ │ ├── ThriftConsumer.java │ │ │ └── ThriftProvider.java │ │ │ ├── async │ │ │ ├── AsyncConsumer.java │ │ │ └── ThriftProvider.java │ │ │ ├── multiport │ │ │ ├── ThriftConsumerMultiApi.java │ │ │ └── ThriftProviderMultiPort.java │ │ │ ├── multirole │ │ │ └── MultiRoleService.java │ │ │ ├── simple │ │ │ ├── ThriftConsumer.java │ │ │ └── ThriftProvider.java │ │ │ ├── zkmock │ │ │ ├── ThriftConsumer.java │ │ │ └── ThriftProvider.java │ │ │ └── zkregistry │ │ │ ├── ThriftConsumer.java │ │ │ └── ThriftProvider.java │ │ └── resources │ │ ├── log4j2.xml │ │ └── thrift │ │ ├── annotation │ │ ├── thrift-consumer.xml │ │ └── thrift-provider.xml │ │ ├── async │ │ ├── thrift-consumer-async.xml │ │ └── thrift-provider-async.xml │ │ ├── multiport │ │ ├── thrift-consumer-multiapi.xml │ │ └── thrift-provider-multiport.xml │ │ ├── multirole │ │ └── thrift-multiroles.xml │ │ ├── simple │ │ ├── thrift-consumer.xml │ │ └── thrift-provider.xml │ │ ├── zkmock │ │ ├── thrift-consumer.xml │ │ └── thrift-provider.xml │ │ └── zkregistry │ │ ├── thrift-consumer.xml │ │ └── thrift-provider.xml ├── dorado-doc │ ├── Introduce.md │ ├── Manual.md │ ├── QuickStart.md │ ├── img │ │ ├── FrameworkDesign.svg │ │ ├── FrameworkPackage.svg │ │ ├── ServiceArchitecture.svg │ │ ├── ThriftFileExample.tiff │ │ └── Timeline.svg │ ├── manual-developer │ │ ├── Compile.md │ │ ├── Extension.md │ │ └── Version.md │ ├── manual-thrift │ │ ├── ThriftSpecification.md │ │ └── api │ │ │ ├── HelloService.java │ │ │ └── HelloServiceImpl.java │ └── manual-user │ │ ├── Config.md │ │ ├── DirectInvoke.md │ │ ├── Filter.md │ │ ├── LoadBalance.md │ │ ├── MethodTimeout.md │ │ ├── Port2MultiService.md │ │ ├── Protocol.md │ │ ├── Registry.md │ │ ├── ShutdownGracefully.md │ │ ├── Trace.md │ │ └── WeightWarmUp.md ├── dorado-protocol │ ├── dorado-protocol-octo │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── codec │ │ │ │ └── octo │ │ │ │ └── meta │ │ │ │ ├── CallType.java │ │ │ │ ├── CompressType.java │ │ │ │ ├── Header.java │ │ │ │ ├── HeartbeatInfo.java │ │ │ │ ├── LoadInfo.java │ │ │ │ ├── MessageType.java │ │ │ │ ├── RequestInfo.java │ │ │ │ ├── ResponseInfo.java │ │ │ │ ├── StatusCode.java │ │ │ │ ├── TraceInfo.java │ │ │ │ └── old │ │ │ │ └── RequestHeader.java │ │ │ └── resources │ │ │ └── idl │ │ │ └── octoProtocolHeader.thrift │ └── pom.xml ├── dorado-registry │ ├── dorado-registry-mns │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── meituan │ │ │ │ │ └── dorado │ │ │ │ │ └── registry │ │ │ │ │ └── mns │ │ │ │ │ ├── MnsChangeListener.java │ │ │ │ │ ├── MnsDiscoveryService.java │ │ │ │ │ ├── MnsRegistryFactory.java │ │ │ │ │ ├── MnsRegistryService.java │ │ │ │ │ └── util │ │ │ │ │ └── MnsUtil.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── com.meituan.dorado.registry.RegistryFactory │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── registry │ │ │ │ └── mns │ │ │ │ ├── MnsRegistryDiscoveryTest.java │ │ │ │ └── MnsServiceNameDiffTest.java │ │ │ └── resources │ │ │ ├── log4j2.xml │ │ │ └── thrift-provider.xml │ ├── dorado-registry-mock │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── registry │ │ │ │ └── mock │ │ │ │ ├── MockDiscoveryService.java │ │ │ │ ├── MockRegistryFactory.java │ │ │ │ └── MockRegistryService.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.meituan.dorado.registry.RegistryFactory │ ├── dorado-registry-zookeeper │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── meituan │ │ │ │ │ └── dorado │ │ │ │ │ └── registry │ │ │ │ │ └── zookeeper │ │ │ │ │ ├── ZookeeperDiscoveryService.java │ │ │ │ │ ├── ZookeeperRegistryFactory.java │ │ │ │ │ ├── ZookeeperRegistryService.java │ │ │ │ │ ├── curator │ │ │ │ │ ├── NodeChangeListener.java │ │ │ │ │ ├── StateChangeListener.java │ │ │ │ │ ├── ZookeeperClient.java │ │ │ │ │ └── ZookeeperManager.java │ │ │ │ │ └── util │ │ │ │ │ ├── ChildNodeData.java │ │ │ │ │ ├── ServiceDetail.java │ │ │ │ │ └── ZooKeeperNodeInfo.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── com.meituan.dorado.registry.RegistryFactory │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── registry │ │ │ │ └── zookeeper │ │ │ │ ├── RegistryTest.java │ │ │ │ ├── ZookeeperClientTest.java │ │ │ │ ├── ZookeeperDiscoveryServiceTest.java │ │ │ │ └── util │ │ │ │ └── ZooKeeperNodeInfoTest.java │ │ │ └── resources │ │ │ └── log4j2.xml │ └── pom.xml ├── dorado-test │ ├── dorado-benchmark-client │ │ ├── pom.xml │ │ ├── script │ │ │ └── run.sh │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── client │ │ │ │ ├── ClientRunner.java │ │ │ │ └── DoradoClient.java │ │ │ ├── resources-remote │ │ │ └── log4j2.xml │ │ │ └── resources │ │ │ ├── benchmark │ │ │ └── client.xml │ │ │ └── log4j2.xml │ ├── dorado-benchmark-server │ │ ├── pom.xml │ │ ├── script │ │ │ └── run.sh │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── server │ │ │ │ ├── EchoImpl.java │ │ │ │ └── ServerRunner.java │ │ │ ├── resources-remote │ │ │ └── log4j2.xml │ │ │ └── resources │ │ │ ├── benchmark │ │ │ └── server.xml │ │ │ └── log4j2.xml │ ├── dorado-test-api │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ ├── serialize │ │ │ │ └── thrift │ │ │ │ │ └── annotation │ │ │ │ │ └── AbstractThriftException.java │ │ │ │ └── test │ │ │ │ └── thrift │ │ │ │ ├── annotationTestService │ │ │ │ ├── InternalErrorException.java │ │ │ │ ├── MyException.java │ │ │ │ ├── TestRequest.java │ │ │ │ ├── TestResponse.java │ │ │ │ ├── TestService.java │ │ │ │ └── TestServiceImpl.java │ │ │ │ ├── annotationTwitter │ │ │ │ ├── Constants.java │ │ │ │ ├── Location.java │ │ │ │ ├── Tweet.java │ │ │ │ ├── TweetSearchResult.java │ │ │ │ ├── TweetType.java │ │ │ │ ├── Twitter.java │ │ │ │ ├── TwitterImpl.java │ │ │ │ └── TwitterUnavailable.java │ │ │ │ ├── api │ │ │ │ ├── Echo.java │ │ │ │ ├── Echo2.java │ │ │ │ ├── EchoImpl.java │ │ │ │ ├── HelloService.java │ │ │ │ ├── HelloServiceAsyncImpl.java │ │ │ │ ├── HelloServiceImpl.java │ │ │ │ └── HelloServiceTimeoutImpl.java │ │ │ │ ├── apisuite │ │ │ │ ├── ExceptionA.java │ │ │ │ ├── ExceptionB.java │ │ │ │ ├── Message.java │ │ │ │ ├── SubMessage.java │ │ │ │ ├── TestSuite.java │ │ │ │ └── TestSuiteImpl.java │ │ │ │ ├── apitwitter │ │ │ │ ├── Location.java │ │ │ │ ├── Tweet.java │ │ │ │ ├── TweetSearchResult.java │ │ │ │ ├── TweetType.java │ │ │ │ ├── Twitter.java │ │ │ │ ├── TwitterIdlConstants.java │ │ │ │ ├── TwitterImpl.java │ │ │ │ └── TwitterUnavailable.java │ │ │ │ └── exception │ │ │ │ └── api │ │ │ │ ├── ApiVersion1.java │ │ │ │ ├── ApiVersion1Impl.java │ │ │ │ ├── ApiVersion2.java │ │ │ │ ├── ApiVersion2Impl.java │ │ │ │ ├── Result1.java │ │ │ │ └── Result2.java │ │ │ └── resources │ │ │ └── thrift │ │ │ ├── ApiVersion1.thrift │ │ │ ├── ApiVersion2.thrift │ │ │ ├── TestSuite.thrift │ │ │ ├── TwitterIdl.thrift │ │ │ ├── echo.thrift │ │ │ └── hello.thrift │ ├── dorado-test-benchmark │ │ ├── pom.xml │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── banchmark │ │ │ │ └── simple │ │ │ │ └── DoradoDemo.java │ │ │ └── resources │ │ │ ├── context.xml │ │ │ ├── log4j2.xml │ │ │ └── service.thrift │ ├── dorado-test-client │ │ ├── pom.xml │ │ ├── script │ │ │ └── run.sh │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── testclient │ │ │ │ ├── ClientMain.java │ │ │ │ └── ClientTest.java │ │ │ └── resources │ │ │ ├── META-INF │ │ │ └── app.properties │ │ │ ├── echomns │ │ │ └── thrift-client.xml │ │ │ ├── echozk │ │ │ └── thrift-client.xml │ │ │ └── log4j2.xml │ ├── dorado-test-integration │ │ ├── pom.xml │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ ├── meituan │ │ │ │ └── dorado │ │ │ │ │ ├── check │ │ │ │ │ └── http │ │ │ │ │ │ ├── HttpCheckHandlerTest.java │ │ │ │ │ │ └── HttpClientUtil.java │ │ │ │ │ └── test │ │ │ │ │ └── thrift │ │ │ │ │ ├── annotation │ │ │ │ │ ├── AnnotationExceptionTest.java │ │ │ │ │ └── AnnotationSyncTest.java │ │ │ │ │ ├── async │ │ │ │ │ ├── AnnotationAsyncTest.java │ │ │ │ │ ├── AsyncTest.java │ │ │ │ │ └── ClientAsyncTest.java │ │ │ │ │ ├── exception │ │ │ │ │ ├── MistakeInterfaceNameTest.java │ │ │ │ │ ├── RequiredFieldChangeTest.java │ │ │ │ │ ├── client │ │ │ │ │ │ └── ReturnNullOrVoidTest.java │ │ │ │ │ └── server │ │ │ │ │ │ ├── BusinessExceptionTest.java │ │ │ │ │ │ ├── ProcessorNotFoundExceptionTest.java │ │ │ │ │ │ └── ServerRejectExceptionTest.java │ │ │ │ │ ├── filter │ │ │ │ │ ├── ClientQpsLimitFilter.java │ │ │ │ │ ├── CustomFilter1.java │ │ │ │ │ ├── CustomFilter2.java │ │ │ │ │ ├── FilterTest.java │ │ │ │ │ ├── InvokerFilter.java │ │ │ │ │ ├── MultiClientTest.java │ │ │ │ │ ├── ProviderFilter.java │ │ │ │ │ ├── ServerQpsLimitFilter.java │ │ │ │ │ ├── SpecificFilter.java │ │ │ │ │ └── TraceFilter.java │ │ │ │ │ ├── methodTimeout │ │ │ │ │ └── MethodTimeoutTest.java │ │ │ │ │ ├── normal │ │ │ │ │ ├── HelloTest.java │ │ │ │ │ ├── TestSuiteTest.java │ │ │ │ │ └── TwitterTest.java │ │ │ │ │ ├── originthrift │ │ │ │ │ └── OriginThriftTest.java │ │ │ │ │ ├── port2multiService │ │ │ │ │ └── Port2multiServiceTest.java │ │ │ │ │ └── timeout │ │ │ │ │ └── TimeoutTest.java │ │ │ │ └── sankuai │ │ │ │ └── mtthrift │ │ │ │ └── testSuite │ │ │ │ └── idlTest │ │ │ │ ├── Location.java │ │ │ │ ├── ThriftTestConstants.java │ │ │ │ ├── Tweet.java │ │ │ │ ├── TweetSearchResult.java │ │ │ │ ├── TweetType.java │ │ │ │ ├── Twitter.java │ │ │ │ ├── TwitterImpl.java │ │ │ │ └── TwitterUnavailable.java │ │ │ └── resources │ │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── com.meituan.dorado.rpc.handler.filter.Filter │ │ │ ├── log4j2.xml │ │ │ └── thrift │ │ │ ├── annotationAsync │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ │ │ ├── annotationException │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ │ │ ├── annotationSync │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ │ │ ├── async │ │ │ ├── thrift-consumer-async.xml │ │ │ └── thrift-provider-async.xml │ │ │ ├── exception │ │ │ ├── business │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── emptyChannel │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── fieldchange │ │ │ │ └── thrift-fieldchange.xml │ │ │ ├── processor │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── protocol │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── threadpool │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── thrift-mistake-interface.xml │ │ │ └── transport │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── filter │ │ │ ├── client.xml │ │ │ ├── multiClient.xml │ │ │ ├── multiServer.xml │ │ │ └── server.xml │ │ │ ├── httpCheck │ │ │ └── thrift-provider.xml │ │ │ ├── methodTimeout │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ │ │ ├── normal │ │ │ ├── hello │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── suite │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ └── twitter │ │ │ │ ├── thrift-consumer.xml │ │ │ │ └── thrift-provider.xml │ │ │ ├── port2multiService │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ │ │ ├── timeout │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ │ │ └── twitterAsync │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ ├── dorado-test-server │ │ ├── pom.xml │ │ ├── script │ │ │ └── run.sh │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── testserver │ │ │ │ ├── ServerMain.java │ │ │ │ └── ThriftClient.java │ │ │ └── resources │ │ │ ├── META-INF │ │ │ └── app.properties │ │ │ ├── echomns │ │ │ ├── thrift-client.xml │ │ │ └── thrift-server.xml │ │ │ ├── echozk │ │ │ ├── thrift-client.xml │ │ │ └── thrift-server.xml │ │ │ └── log4j2.xml │ └── pom.xml ├── dorado-trace │ ├── dorado-trace-cat │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── meituan │ │ │ │ │ └── dorado │ │ │ │ │ └── trace │ │ │ │ │ └── cat │ │ │ │ │ └── CatInvokeTrace.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── com.meituan.dorado.trace.InvokeTrace │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── trace │ │ │ │ └── cat │ │ │ │ └── CatInvokeTraceTest.java │ │ │ └── resources │ │ │ ├── META-INF │ │ │ ├── app.properties │ │ │ └── services │ │ │ │ └── com.meituan.dorado.trace.InvokeTrace │ │ │ ├── log4j2.xml │ │ │ └── thrift │ │ │ ├── thrift-consumer.xml │ │ │ └── thrift-provider.xml │ └── pom.xml ├── dorado-transport │ ├── dorado-transport-httpnetty │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── transport │ │ │ │ └── http │ │ │ │ └── netty │ │ │ │ ├── NettyHttpSender.java │ │ │ │ ├── NettyHttpServer.java │ │ │ │ ├── NettyHttpServerFactory.java │ │ │ │ └── NettyHttpServerHandler.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.meituan.dorado.transport.http.HttpServerFactory │ ├── dorado-transport-netty │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── meituan │ │ │ │ │ └── dorado │ │ │ │ │ └── transport │ │ │ │ │ └── netty │ │ │ │ │ ├── ChannelManager.java │ │ │ │ │ ├── NettyChannel.java │ │ │ │ │ ├── NettyClient.java │ │ │ │ │ ├── NettyClientFactory.java │ │ │ │ │ ├── NettyClientHandler.java │ │ │ │ │ ├── NettyCodec.java │ │ │ │ │ ├── NettyServer.java │ │ │ │ │ ├── NettyServerFactory.java │ │ │ │ │ └── NettyServerHandler.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ ├── com.meituan.dorado.transport.ClientFactory │ │ │ │ └── com.meituan.dorado.transport.ServerFactory │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── meituan │ │ │ │ └── dorado │ │ │ │ └── transport │ │ │ │ └── netty │ │ │ │ ├── NettyClientTest.java │ │ │ │ ├── NettyServerTest.java │ │ │ │ └── NettyTest.java │ │ │ └── resources │ │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── com.meituan.dorado.codec.Codec │ │ │ └── log4j2.xml │ └── pom.xml └── pom.xml └── whale ├── .idea └── workspace.xml ├── CMakeLists.txt ├── README.md ├── build.sh ├── cmake ├── CMakeLists.download_gtest.in ├── CodeCoverage.cmake ├── DonwloadMuduo.cmake ├── FindGtest.cmake ├── FindMuduo.cmake ├── FindThrift.cmake ├── SetupGtest.cmake └── module.cmake ├── cthrift ├── CMakeLists.txt ├── cthrift_async_callback.h ├── cthrift_client.cc ├── cthrift_client.h ├── cthrift_client_channel.cc ├── cthrift_client_channel.h ├── cthrift_client_worker.cc ├── cthrift_client_worker.h ├── cthrift_name_service.cc ├── cthrift_name_service.h ├── cthrift_svr.cc ├── cthrift_svr.h ├── cthrift_tbinary_protocol.h ├── cthrift_tbinary_protocol.tcc ├── cthrift_transport.cc ├── cthrift_transport.h ├── tests │ ├── CMakeLists.txt │ ├── conf.json │ ├── cthrift_channel_unittest.cc │ ├── cthrift_client_unittest.cc │ ├── cthrift_client_worker_unittest.cc │ ├── cthrift_common_unittest.cc │ ├── cthrift_server_unittest.cc │ ├── cthrift_sg_agent_unittest.cc │ ├── cthrift_transport_unittest.cc │ ├── cthrift_util_zk_tools_unittest.cc │ ├── echo.thrift │ ├── echo │ │ ├── Echo.cpp │ │ ├── Echo.h │ │ ├── Echo_async_server.skeleton.cpp │ │ ├── Echo_server.skeleton.cpp │ │ ├── echo_constants.cpp │ │ ├── echo_constants.h │ │ ├── echo_types.cpp │ │ └── echo_types.h │ ├── log4cplus.conf │ ├── main.cc │ ├── main_all.cc │ ├── main_async.cc │ └── main_svr.cc └── util │ ├── cthrift_common.cc │ ├── cthrift_common.h │ ├── cthrift_config.cc │ ├── cthrift_config.h │ ├── cthrift_mns_imp.cc │ ├── cthrift_mns_imp.h │ ├── cthrift_ns_imp.cc │ ├── cthrift_ns_imp.h │ ├── cthrift_ns_interface.h │ ├── cthrift_zk_client.cc │ ├── cthrift_zk_client.h │ ├── log4cplus.cc │ ├── log4cplus.h │ ├── task_context.h │ ├── zk_client.cc │ ├── zk_client.h │ ├── zk_tools.cc │ └── zk_tools.h ├── docs ├── Quick_start.md ├── Whale-config.md └── image │ ├── bench_test_1.png │ ├── bench_test_2.png │ ├── cthrift-ar.jpg │ ├── cthrift_async.jpg │ ├── cthrift_client.jpg │ ├── cthrift_q.png │ ├── cthrift_server.jpg │ └── register.png ├── example ├── CMakeLists.txt ├── conf.json ├── cthrift_async_example.cc ├── cthrift_cli_example.cc ├── cthrift_svr_example.cc ├── echo.thrift ├── echo │ ├── Echo.cpp │ ├── Echo.h │ ├── Echo_async_server.skeleton.cpp │ ├── Echo_server.skeleton.cpp │ ├── echo_constants.cpp │ ├── echo_constants.h │ ├── echo_types.cpp │ └── echo_types.h └── log4cplus.conf ├── patch └── 0001-add-patch-for-http.patch ├── thrid ├── include │ ├── mns_sdk │ │ ├── mns_sdk.h │ │ ├── mns_worker.h │ │ ├── thrift_client.h │ │ └── util │ │ │ ├── mns_common.h │ │ │ ├── mns_config.h │ │ │ ├── mns_log.h │ │ │ └── mns_sdk_common.h │ └── octoidl │ │ ├── MNSCacheService.h │ │ ├── ServiceAgent.h │ │ ├── ThriftSpans_constants.h │ │ ├── ThriftSpans_types.h │ │ ├── mnsc_data_constants.h │ │ ├── mnsc_data_types.h │ │ ├── mnsc_service_constants.h │ │ ├── mnsc_service_types.h │ │ ├── naming_common_constants.h │ │ ├── naming_common_types.h │ │ ├── naming_data_constants.h │ │ ├── naming_data_types.h │ │ ├── naming_service_constants.h │ │ ├── naming_service_types.h │ │ ├── unified_protocol_constants.h │ │ └── unified_protocol_types.h └── lib │ ├── libmns_sdk.a │ ├── libmns_sdk.so │ ├── liboctoidl.a │ └── liboctoidl.so └── tool └── clear4git.sh /README.md: -------------------------------------------------------------------------------- 1 | # OCTO-RPC 服务通信框架 # 2 | 3 | ## 背景 ## 4 |       随着分布式技术和微服务思想流行,技术公司逐步将服务拆分为独立运行的小模块,提高系统整体的健壮性,加快特性的演进速度。微服务通过定义完善的接口进行交互,解耦系统、敏捷迭代、方便服务治理。RPC是目前微服务最广泛的通信方式。然而,众多团队各自研发具备服务治理功能的RPC通信框架,一方面增加开发成本,消耗人力重复造轮子;另一方面不同序列化协议的RPC服务,无法互相通信,影响可用性。因此,通用的RPC通信框架能大大提升公司技术团队的研发效率,便于服务治理。 5 | 6 | 目前美团内部的Mtransport就是一套统一的服务通信框架,为近万个美团应用提供高效的通信服务。 7 | 8 | 美团致力于将Mtransport定位成一组高性能、高可用的企业级RPC通信框架,现将已在公司广泛使用,成熟稳定的Mtransport进行开源,开源后总名称为OCTO-RPC,其中第一批包括Dorado(Java)、Whale(C++)两个语言版本,希望与业内同样有通信框架需求的团队同仁,在OCTO-RPC基础上一起打造一款企业级优良的RPC通信框架产品。 9 | 10 | ## 介绍 ## 11 | 对服务开发者, MTransport 屏蔽了底层网络通信细节,从而更专注于业务自身逻辑实现。支持不同语言版本的代码实现, 保持通信协议的一致性,支持服务注册、服务发现、异步通信、负载均衡等丰富的服务治理功能。 12 | 13 | ![avatar](whale/docs/image/register.png) 14 | 15 | [详见 Dorado(Java)](dorado/README.md) 16 | [详见 Whale(C\C++)](whale/README.md) 17 | 18 | 19 | ## 未来规划 ## 20 | - 支持更多序列化协议 21 | - 完善限流、熔断等降级措施 22 | - 服务端异步 23 | - 协程,并行计算,流式编程 24 | 25 | 希望和各位同行共同打造一款企业级高可用、高可靠的微服务RPC通信基础框架产品,欢迎大家共建。 26 | 27 | ### Copyright and License 28 | 29 | [Apache 2.0 License.](/LICENSE) 30 | 31 | ### 联系我们 32 | 33 | 我们需要知道你对OCTO-RPC的一些看法以及建议: 34 | 35 | - Mail: inf.octo.os@meituan.com 36 | - [**Issues**](https://github.com/Meituan-Dianping/octo-rpc/issues) 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /dorado/.gitignore: -------------------------------------------------------------------------------- 1 | # maven ignore 2 | target/ 3 | #*.jar 4 | !.mvn/wrapper/* 5 | *.war 6 | *.zip 7 | *.tar 8 | *.tar.gz 9 | dependency-reduced-pom.xml 10 | 11 | # eclipse ignore 12 | .settings/ 13 | .project 14 | .classpath 15 | 16 | # idea ignore 17 | .idea/ 18 | *.ipr 19 | *.iml 20 | *.iws 21 | 22 | # temp ignore 23 | *.log 24 | *.cache 25 | *.diff 26 | *.patch 27 | *.tmp 28 | .gradle/ 29 | gradle/ 30 | gradlew* 31 | 32 | # system ignore 33 | .DS_Store 34 | Thumbs.db 35 | 36 | -------------------------------------------------------------------------------- /dorado/README.md: -------------------------------------------------------------------------------- 1 | # OCTO-Dorado 2 | 3 | ## 简要介绍 4 | - Dorado是OCTO生态中的一员,为Java服务提供具备治理功能的RPC通信框架。美团内部服务之间使用OCTO协议进行通信,默认支持Thrift,便于不同语言服务之间互通。 5 | 6 | - Dorado提供了丰富的服务注册/发现、路由、负载均衡、容错等功能来满足服务治理需要。 7 | 8 | - Dorado易扩展和简洁的设计可以让使用者和开发者更容易且灵活地对Dorado进行功能扩展和改造。 9 | 10 | - Dorado的目标是构建一套更易用、更高效、更可靠,具有良好扩展性的分布式通信框架。 11 | 12 | 13 | ## 框架特点 14 | - **模块化,易扩展** 15 | 16 | 各个模块拆分实现,提供很多扩展点,可以根据需要扩展自己的实现模块,打造出适合自己服务的框架; 17 | 18 | - **微内核,可插拔** 19 | 20 | 核心模块不会依赖于任何具体扩展,每个实现模块都可以自由组合,按需引入; 21 | 22 | - **实现简洁,链路清晰** 23 | 24 | 框架设计简洁,主干调用链路清晰; 25 | 26 | - **高性能,高可用** 27 | 28 | 默认提供Netty作为网络传输框架和Thrift协议,在目前的Java框架中表现较优,服务端1K数据压测QPS稳定在**12W+**; 29 | 服务端节点异常自动降级探测,提升调用端服务的可用性。 30 | 31 | ## 详细介绍 32 | 更多关于框架的介绍见:[OCTO-Dorado通信框架介绍](https://github.com/Meituan-Dianping/octo-rpc/wiki/OCTO-Dorado%E9%80%9A%E4%BF%A1%E6%A1%86%E6%9E%B6%E4%BB%8B%E7%BB%8D) 33 | 34 | ## 使用文档 35 | - [快速开始](dorado-doc/QuickStart.md) 36 | 37 | - [使用说明手册](dorado-doc/Manual.md) 38 | 39 | - [构建Jar](dorado-doc/manual-developer/Compile.md) 40 | 41 | ## 开源协议 42 | Dorado基于[Apache License 2.0](LICENSE)协议。 43 | 44 | ## 联系我们 45 | - Email: inf.octo.os@meituan.com 46 | - Issues: [Issues](https://github.com/Meituan-Dianping/octo-rpc/issues) 47 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/Role.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common; 17 | 18 | public interface Role { 19 | 20 | RpcRole getRole(); 21 | } 22 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/RpcRole.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common; 17 | 18 | public enum RpcRole { 19 | INVOKER, PROVIDER, MULTIROLE 20 | } 21 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/ApplicationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 业务异常,服务端业务接口方法执行异常时抛出 20 | */ 21 | public class ApplicationException extends DoradoException { 22 | 23 | public ApplicationException(String msg) { 24 | super(msg); 25 | } 26 | 27 | public ApplicationException(Throwable cause) { 28 | super(cause); 29 | } 30 | 31 | public ApplicationException(String msg, Throwable cause) { 32 | super(msg, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/DegradeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 降级异常,调用端或服务端降级时抛出 20 | */ 21 | public class DegradeException extends DoradoException { 22 | 23 | public DegradeException(String msg) { 24 | super(msg); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/DoradoException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | public class DoradoException extends RuntimeException { 19 | 20 | public DoradoException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | public DoradoException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public DoradoException(String msg, Throwable cause) { 29 | super(msg, cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/FilterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 用于过滤器中抛出, 便于业务在自定义Filter抛出明确异常 20 | */ 21 | public class FilterException extends RuntimeException { 22 | 23 | public FilterException(String message) { 24 | super(message); 25 | } 26 | 27 | public FilterException(String s, Throwable e) { 28 | super(s, e); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/ProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 序列化和编解码模块抛出的异常 20 | */ 21 | public class ProtocolException extends DoradoException { 22 | 23 | public ProtocolException(String msg) { 24 | super(msg); 25 | } 26 | 27 | public ProtocolException(String msg, Throwable cause) { 28 | super(msg, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/RegistryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 服务注册发现模块抛出的异常 20 | */ 21 | public class RegistryException extends RpcException { 22 | 23 | public RegistryException(String msg) { 24 | super(msg); 25 | } 26 | 27 | public RegistryException(String msg, Throwable cause) { 28 | super(msg, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/RemoteException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 调用端向服务端发起调用的不明确异常,除超时、中断外的异常 20 | */ 21 | public class RemoteException extends DoradoException { 22 | 23 | public RemoteException(String msg) { 24 | super(msg); 25 | } 26 | 27 | public RemoteException(String msg, Throwable cause) { 28 | super(msg, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/RpcException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 框架异常, 非其它定义异常时,定义为框架异常 20 | * 对应StatusCode的RpcException 21 | */ 22 | public class RpcException extends DoradoException { 23 | 24 | public RpcException(String msg) { 25 | super(msg); 26 | } 27 | 28 | public RpcException(Throwable cause) { 29 | super(cause); 30 | } 31 | 32 | public RpcException(String msg, Throwable cause) { 33 | super(msg, cause); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/ServiceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 服务异常,如服务端找不到对应的服务或方法 20 | * 21 | */ 22 | public class ServiceException extends DoradoException { 23 | 24 | public ServiceException(String msg) { 25 | super(msg); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/TimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | public class TimeoutException extends TransportException { 19 | 20 | public TimeoutException(String message) { 21 | super(message); 22 | } 23 | 24 | public TimeoutException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public TimeoutException(Throwable cause) { 29 | super(cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/exception/TransportException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.exception; 17 | 18 | /** 19 | * 传输层异常 20 | */ 21 | public class TransportException extends DoradoException { 22 | 23 | public TransportException(String message) { 24 | super(message); 25 | } 26 | 27 | public TransportException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public TransportException(Throwable cause) { 32 | super(cause.getMessage(), cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/extension/SPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.extension; 17 | 18 | import java.lang.annotation.*; 19 | 20 | @Documented 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target({ElementType.TYPE}) 23 | public @interface SPI { 24 | } 25 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/main/java/com/meituan/dorado/common/util/ClassLoaderUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.util; 17 | 18 | import org.apache.commons.lang3.ClassUtils; 19 | 20 | public class ClassLoaderUtil { 21 | 22 | public static Class loadClass(ClassLoader classLoader, String className) throws ClassNotFoundException { 23 | if (classLoader == null) { 24 | classLoader = Thread.currentThread().getContextClassLoader(); 25 | } 26 | return ClassUtils.getClass(classLoader, className); 27 | } 28 | 29 | public static Class loadClass(String className) throws ClassNotFoundException { 30 | return loadClass(null, className); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/java/com/meituan/dorado/common/extension/Extension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.extension; 17 | 18 | import com.meituan.dorado.common.Role; 19 | 20 | @SPI 21 | public interface Extension extends Role { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/java/com/meituan/dorado/common/extension/FirstExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.extension; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | 20 | public class FirstExtension implements Extension { 21 | 22 | @Override 23 | public RpcRole getRole() { 24 | return RpcRole.PROVIDER; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/java/com/meituan/dorado/common/extension/SecondExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.extension; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | 20 | public class SecondExtension implements Extension { 21 | 22 | @Override 23 | public RpcRole getRole() { 24 | return RpcRole.INVOKER; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/java/com/meituan/dorado/common/util/VersionUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.common.util; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | 21 | public class VersionUtilTest { 22 | 23 | @Test 24 | public void testGetDoradoVersion() { 25 | String version = VersionUtil.getDoradoVersion(); 26 | Assert.assertEquals(version, "dorado-v${dorado.version}"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/resources/META-INF/services/com.meituan.dorado.common.extension.Extension: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.common.extension.FirstExtension 2 | com.meituan.dorado.common.extension.SecondExtension -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/resources/dorado-application.properties: -------------------------------------------------------------------------------- 1 | dorado.version=${dorado.version} -------------------------------------------------------------------------------- /dorado/dorado-common/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/java/com/meituan/dorado/rpc/handler/invoker/DoradoInvokerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.invoker; 17 | 18 | import com.meituan.dorado.config.service.ClientConfig; 19 | import com.meituan.dorado.registry.meta.Provider; 20 | 21 | public class DoradoInvokerFactory implements InvokerFactory { 22 | 23 | @Override 24 | public Invoker buildInvoker(ClientConfig cfg, Provider provider) { 25 | return new DoradoInvoker(cfg, provider); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/java/com/meituan/dorado/rpc/handler/provider/DoradoProviderInvokeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.provider; 17 | 18 | import com.meituan.dorado.transport.meta.DefaultRequest; 19 | import com.meituan.dorado.transport.meta.DefaultResponse; 20 | import com.meituan.dorado.transport.meta.Request; 21 | import com.meituan.dorado.transport.meta.Response; 22 | 23 | public class DoradoProviderInvokeHandler extends AbstractProviderInvokeHandler { 24 | 25 | @Override 26 | public Response buildResponse(Request request) { 27 | DefaultRequest defaultRequest = (DefaultRequest) request; 28 | return new DefaultResponse(defaultRequest); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.bootstrap.ExtensionInitializer: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.serialize.thrift.annotation.ThriftAnnotationExtensionInitializer -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.check.http.HttpCheckHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.check.http.DoradoHttpCheckHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.cluster.Cluster: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.tolerance.FailoverCluster 2 | com.meituan.dorado.cluster.tolerance.FailbackCluster 3 | com.meituan.dorado.cluster.tolerance.FailfastCluster -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.cluster.LoadBalance: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.loadbalance.RandomLoadBalance 2 | com.meituan.dorado.cluster.loadbalance.RoundRobinLoadBalance -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.cluster.Router: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.router.NoneRouter -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.codec.Codec: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.codec.octo.DoradoCodec -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.handler.HandlerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.DoradoHandlerFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.handler.HeartBeatInvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.provider.ScannerHeartBeatInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.handler.InvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.invoker.DoradoInvokerInvokeHandler 2 | com.meituan.dorado.rpc.handler.provider.DoradoProviderInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.handler.filter.Filter: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.filter.DoradoInvokerTraceFilter 2 | com.meituan.dorado.rpc.handler.filter.DoradoProviderTraceFilter -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.handler.http.HttpInvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.http.DoradoHttpInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.handler.invoker.InvokerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.invoker.DoradoInvokerFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.rpc.proxy.ProxyFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.proxy.jdk.JdkProxyFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/main/resources/META-INF/services/com.meituan.dorado.transport.LengthDecoder: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.transport.DoradoLengthDecoder -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/HelloService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado; 17 | 18 | 19 | import org.apache.thrift.TException; 20 | 21 | public interface HelloService { 22 | 23 | String sayHello(String message); 24 | 25 | String sayBye(String message) throws Exception; 26 | 27 | interface Iface { 28 | String sayHello(String message) throws TException; 29 | 30 | String sayBye(String message) throws TException; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado; 17 | 18 | 19 | import com.meituan.dorado.common.exception.RpcException; 20 | 21 | public class HelloServiceImpl implements HelloService { 22 | 23 | @Override 24 | public String sayHello(String message) { 25 | return message; 26 | } 27 | 28 | @Override 29 | public String sayBye(String message) { 30 | throw new RpcException("mock rpcException."); 31 | } 32 | } -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.config.service.ClientConfig; 19 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 20 | import com.meituan.dorado.transport.Client; 21 | import com.meituan.dorado.transport.ClientFactory; 22 | 23 | 24 | public class MockClientFactory implements ClientFactory { 25 | 26 | @Override 27 | public Client buildClient(ClientConfig config, Invoker invoker) { 28 | return new MockClient(config, invoker); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.codec.Codec; 20 | import com.meituan.dorado.transport.Channel; 21 | 22 | import java.io.IOException; 23 | import java.util.Map; 24 | 25 | public class MockCodec implements Codec { 26 | 27 | @Override 28 | public byte[] encode(Channel channel, Object message, Map attachments) { 29 | return new byte[0]; 30 | } 31 | 32 | @Override 33 | public Object decode(Channel channel, byte[] buffer, Map attachments) { 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockFilterHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.filter.FilterHandler; 20 | import com.meituan.dorado.rpc.meta.RpcInvocation; 21 | import com.meituan.dorado.rpc.meta.RpcResult; 22 | 23 | public class MockFilterHandler implements FilterHandler { 24 | 25 | @Override 26 | public RpcResult handle(RpcInvocation invocation) throws Throwable { 27 | return new RpcResult(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.rpc.handler.AbstractHandlerFactory; 20 | import com.meituan.dorado.rpc.handler.InvokeHandler; 21 | 22 | public class MockHandlerFactory extends AbstractHandlerFactory { 23 | 24 | 25 | @Override 26 | protected InvokeHandler getOtherInvocationHandler(int messageType, RpcRole rpcRole) { 27 | return new MockInvokeHandler(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockHttpServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.transport.http.AbstractHttpServer; 20 | 21 | import java.net.InetSocketAddress; 22 | 23 | public class MockHttpServer extends AbstractHttpServer { 24 | 25 | public MockHttpServer(RpcRole role) { 26 | super(role); 27 | } 28 | 29 | @Override 30 | protected void doStart() { 31 | bindPort(); 32 | } 33 | 34 | @Override 35 | protected void doBind(InetSocketAddress localAddress) { 36 | 37 | } 38 | 39 | @Override 40 | protected void doClose() { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockInvokerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.config.service.ClientConfig; 20 | import com.meituan.dorado.registry.meta.Provider; 21 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 22 | import com.meituan.dorado.rpc.handler.invoker.InvokerFactory; 23 | 24 | public class MockInvokerFactory implements InvokerFactory{ 25 | 26 | @Override 27 | public Invoker buildInvoker(ClientConfig config, Provider provider) { 28 | return new MockInvoker(provider, config.getServiceInterface()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockInvokerFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.filter.FilterHandler; 20 | import com.meituan.dorado.rpc.handler.invoker.AbstractInvokerFilter; 21 | import com.meituan.dorado.rpc.meta.RpcInvocation; 22 | import com.meituan.dorado.rpc.meta.RpcResult; 23 | 24 | public class MockInvokerFilter extends AbstractInvokerFilter { 25 | 26 | @Override 27 | public RpcResult filter(RpcInvocation invocation, FilterHandler nextHandler) throws Throwable { 28 | return new RpcResult(); 29 | } 30 | 31 | @Override 32 | public int getPriority() { 33 | return 2; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockInvokerTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.invoker.AbstractInvokerTraceFilter; 20 | import com.meituan.dorado.trace.meta.TraceParam; 21 | import com.meituan.dorado.trace.meta.TraceTimeline; 22 | import com.meituan.dorado.transport.meta.Request; 23 | 24 | public class MockInvokerTraceFilter extends AbstractInvokerTraceFilter { 25 | 26 | @Override 27 | protected TraceParam genTraceParam(Request request, TraceTimeline timeline) { 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockLoadBalance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.cluster.loadbalance.AbstractLoadBalance; 20 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 21 | 22 | import java.util.List; 23 | 24 | public class MockLoadBalance extends AbstractLoadBalance { 25 | 26 | @Override 27 | protected Invoker doSelect(List> invokers) { 28 | return invokers.get(0); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockProviderFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.filter.FilterHandler; 20 | import com.meituan.dorado.rpc.handler.provider.AbstractProviderFilter; 21 | import com.meituan.dorado.rpc.meta.RpcInvocation; 22 | import com.meituan.dorado.rpc.meta.RpcResult; 23 | 24 | public class MockProviderFilter extends AbstractProviderFilter { 25 | 26 | @Override 27 | public RpcResult filter(RpcInvocation invocation, FilterHandler nextHandler) throws Throwable { 28 | return new RpcResult(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockProviderTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.provider.AbstractProviderTraceFilter; 20 | import com.meituan.dorado.trace.meta.TraceParam; 21 | import com.meituan.dorado.trace.meta.TraceTimeline; 22 | import com.meituan.dorado.transport.meta.Request; 23 | 24 | public class MockProviderTraceFilter extends AbstractProviderTraceFilter { 25 | 26 | @Override 27 | protected TraceParam genTraceParam(Request request, TraceTimeline timeline) { 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/java/com/meituan/dorado/mock/MockRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.registry.Registry; 20 | import com.meituan.dorado.registry.RegistryPolicy; 21 | 22 | public class MockRegistry implements Registry { 23 | 24 | @Override 25 | public void destroy() {} 26 | 27 | @Override 28 | public void setRegistryPolicy(RegistryPolicy registryPolicy) {} 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.check.http.HttpCheckHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.check.http.DoradoHttpCheckHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.cluster.Cluster: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.tolerance.FailoverCluster 2 | com.meituan.dorado.cluster.tolerance.FailbackCluster 3 | com.meituan.dorado.cluster.tolerance.FailfastCluster -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.cluster.LoadBalance: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.loadbalance.RandomLoadBalance 2 | com.meituan.dorado.cluster.loadbalance.RoundRobinLoadBalance -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.cluster.Router: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.router.NoneRouter -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.codec.Codec: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.codec.octo.DoradoCodec -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.HandlerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.DoradoHandlerFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.HeartBeatInvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.provider.ScannerHeartBeatInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.InvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.invoker.DoradoInvokerInvokeHandler 2 | com.meituan.dorado.rpc.handler.provider.DoradoProviderInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.filter.Filter: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.filter.AccessLogFilter 2 | com.meituan.dorado.rpc.handler.filter.DoradoInvokerTraceFilter 3 | com.meituan.dorado.rpc.handler.filter.DoradoProviderTraceFilter -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.filter.ServiceInvocationFilter: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.filter.AccessLogFilter 2 | com.meituan.dorado.rpc.handler.filter.DoradoInvokerTraceFilter 3 | com.meituan.dorado.rpc.handler.filter.DoradoProviderTraceFilter -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.http.HttpInvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.http.DoradoHttpInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.invoker.InvokerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.invoker.DoradoInvokerFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.rpc.proxy.ProxyFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.proxy.jdk.JdkProxyFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.transport.ClientFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockClientFactory -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/META-INF/services/com.meituan.dorado.transport.LengthDecoder: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.transport.DoradoLengthDecoder -------------------------------------------------------------------------------- /dorado/dorado-core-default/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/bootstrap/ExtensionInitializer.java: -------------------------------------------------------------------------------- 1 | package com.meituan.dorado.bootstrap; 2 | 3 | import com.meituan.dorado.common.RpcRole; 4 | import com.meituan.dorado.common.extension.SPI; 5 | import com.meituan.dorado.config.service.AbstractConfig; 6 | 7 | @SPI 8 | public interface ExtensionInitializer { 9 | 10 | void init(AbstractConfig config, RpcRole rpcRole); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/check/http/HttpCheckHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.check.http; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.rpc.handler.http.HttpHandler; 20 | 21 | @SPI 22 | public interface HttpCheckHandler extends HttpHandler { 23 | } 24 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/Cluster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | 20 | @SPI 21 | public interface Cluster { 22 | 23 | ClusterHandler buildClusterHandler(InvokerRepository repository); 24 | } 25 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/LoadBalance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 20 | 21 | import java.util.List; 22 | 23 | @SPI 24 | public interface LoadBalance { 25 | 26 | Invoker select(List> invokers); 27 | } 28 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/Router.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 20 | 21 | import java.util.List; 22 | 23 | @SPI 24 | public interface Router { 25 | 26 | List> route(List> invokers); 27 | 28 | String getName(); 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/router/NoneRouter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster.router; 17 | 18 | import com.meituan.dorado.cluster.Router; 19 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 20 | 21 | import java.util.List; 22 | 23 | public class NoneRouter implements Router { 24 | 25 | private static final String NAME = "none"; 26 | 27 | @Override 28 | public List> route(List> invokers) { 29 | return invokers; 30 | } 31 | 32 | @Override 33 | public String getName() { 34 | return NAME; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/tolerance/FailbackCluster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster.tolerance; 17 | 18 | import com.meituan.dorado.cluster.Cluster; 19 | import com.meituan.dorado.cluster.ClusterHandler; 20 | import com.meituan.dorado.cluster.InvokerRepository; 21 | 22 | public class FailbackCluster implements Cluster { 23 | 24 | @Override 25 | public ClusterHandler buildClusterHandler(InvokerRepository repository) { 26 | return new FailbackClusterHandler<>(repository); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/tolerance/FailfastCluster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster.tolerance; 17 | 18 | import com.meituan.dorado.cluster.Cluster; 19 | import com.meituan.dorado.cluster.ClusterHandler; 20 | import com.meituan.dorado.cluster.InvokerRepository; 21 | 22 | public class FailfastCluster implements Cluster { 23 | 24 | @Override 25 | public ClusterHandler buildClusterHandler(InvokerRepository repository) { 26 | return new FailfastClusterHandler(repository); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/cluster/tolerance/FailoverCluster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.cluster.tolerance; 17 | 18 | import com.meituan.dorado.cluster.Cluster; 19 | import com.meituan.dorado.cluster.ClusterHandler; 20 | import com.meituan.dorado.cluster.InvokerRepository; 21 | 22 | public class FailoverCluster implements Cluster { 23 | 24 | @Override 25 | public ClusterHandler buildClusterHandler(InvokerRepository repository) { 26 | return new FailoverClusterHandler<>(repository); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/codec/Codec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.codec; 17 | 18 | import com.meituan.dorado.common.exception.ProtocolException; 19 | import com.meituan.dorado.common.extension.SPI; 20 | import com.meituan.dorado.transport.Channel; 21 | 22 | import java.util.Map; 23 | 24 | @SPI 25 | public interface Codec { 26 | 27 | byte[] encode(Channel channel, Object message, Map attachments) throws ProtocolException; 28 | 29 | Object decode(Channel channel, byte[] buffer, Map attachments) throws ProtocolException; 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/config/service/spring/ServiceBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.config.service.spring; 17 | 18 | import com.meituan.dorado.config.service.ProviderConfig; 19 | import org.springframework.beans.factory.DisposableBean; 20 | import org.springframework.beans.factory.InitializingBean; 21 | 22 | public class ServiceBean extends ProviderConfig implements InitializingBean, DisposableBean { 23 | 24 | @Override 25 | public void afterPropertiesSet() throws Exception { 26 | init(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/registry/DiscoveryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry; 17 | 18 | import com.meituan.dorado.registry.meta.SubscribeInfo; 19 | 20 | public interface DiscoveryService extends Registry { 21 | 22 | void subscribe(SubscribeInfo info, ProviderListener listener); 23 | 24 | void unsubscribe(SubscribeInfo info); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/registry/ProviderListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry; 17 | 18 | import com.meituan.dorado.registry.meta.Provider; 19 | 20 | import java.util.List; 21 | 22 | public interface ProviderListener { 23 | 24 | void notify(List providers); 25 | 26 | void added(List providers); 27 | 28 | void updated(List providers); 29 | 30 | void removed(List ipPorts); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/registry/Registry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry; 17 | 18 | public interface Registry { 19 | 20 | enum OperType { 21 | REGISTRY, DISCOVERY; 22 | } 23 | 24 | void destroy(); 25 | 26 | void setRegistryPolicy(RegistryPolicy registryPolicy); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/registry/RegistryFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | 20 | import java.util.Map; 21 | 22 | @SPI 23 | public interface RegistryFactory { 24 | 25 | RegistryPolicy getRegistryPolicy(Map registryInfo, Registry.OperType type); 26 | 27 | RegistryService getRegistryService(String address); 28 | 29 | DiscoveryService getDiscoveryService(String address); 30 | 31 | String getName(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/registry/RegistryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry; 17 | 18 | import com.meituan.dorado.registry.meta.RegistryInfo; 19 | 20 | public interface RegistryService extends Registry { 21 | 22 | void register(RegistryInfo info); 23 | 24 | void unregister(RegistryInfo info); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/ResponseCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc; 17 | 18 | public interface ResponseCallback { 19 | 20 | void onComplete(V result); 21 | 22 | void onError(Throwable e); 23 | } -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/HandlerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.common.extension.SPI; 20 | 21 | @SPI 22 | public interface HandlerFactory { 23 | 24 | InvokeHandler getInvocationHandler(int messageType, RpcRole rpcRole); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/HeartBeatInvokeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | 20 | @SPI 21 | public interface HeartBeatInvokeHandler extends InvokeHandler { 22 | } 23 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/InvokeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler; 17 | 18 | import com.meituan.dorado.common.Role; 19 | import com.meituan.dorado.common.extension.SPI; 20 | import com.meituan.dorado.transport.meta.Request; 21 | import com.meituan.dorado.transport.meta.Response; 22 | 23 | /** 24 | * 服务调用handler 25 | */ 26 | @SPI 27 | public interface InvokeHandler extends Role { 28 | 29 | Response handle(Request request) throws Throwable; 30 | 31 | Response buildResponse(Request request); 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/filter/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.filter; 17 | 18 | import com.meituan.dorado.common.Role; 19 | import com.meituan.dorado.common.extension.SPI; 20 | import com.meituan.dorado.rpc.meta.RpcInvocation; 21 | import com.meituan.dorado.rpc.meta.RpcResult; 22 | 23 | /** 24 | * 过滤器接口, 业务可自行实现 25 | * 26 | * 注意:同一个Filter重复添加无效, 只执行一次 27 | */ 28 | @SPI 29 | public interface Filter extends Role { 30 | 31 | /** 32 | * 值越大 优先级越高, 接口调用前最先执行 33 | */ 34 | int getPriority(); 35 | 36 | RpcResult filter(RpcInvocation invocation, FilterHandler nextHandler) throws Throwable; 37 | } 38 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/filter/FilterHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.filter; 17 | 18 | import com.meituan.dorado.rpc.meta.RpcInvocation; 19 | import com.meituan.dorado.rpc.meta.RpcResult; 20 | 21 | 22 | public interface FilterHandler { 23 | 24 | RpcResult handle(RpcInvocation invocation) throws Throwable; 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/http/HttpHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.http; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.transport.http.HttpSender; 20 | 21 | import java.util.Map; 22 | 23 | public interface HttpHandler { 24 | 25 | void handle(HttpSender httpSender, String uri, byte[] content, Map headers); 26 | 27 | void setRole(RpcRole role); 28 | 29 | RpcRole getRole(); 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/http/HttpInvokeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.http; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | 20 | /** 21 | * 处理http服务请求调用 22 | */ 23 | @SPI 24 | public interface HttpInvokeHandler extends HttpHandler { 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/invoker/AbstractInvokerFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.invoker; 17 | 18 | import com.meituan.dorado.common.Constants; 19 | import com.meituan.dorado.common.RpcRole; 20 | import com.meituan.dorado.rpc.handler.filter.Filter; 21 | 22 | public abstract class AbstractInvokerFilter implements Filter { 23 | 24 | @Override 25 | public int getPriority() { 26 | return Constants.DEFAULT_FILTER_PRIORITY; 27 | } 28 | 29 | @Override 30 | public RpcRole getRole() { 31 | return RpcRole.INVOKER; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/invoker/InvokerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.invoker; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.config.service.ClientConfig; 20 | import com.meituan.dorado.registry.meta.Provider; 21 | 22 | @SPI 23 | public interface InvokerFactory { 24 | 25 | Invoker buildInvoker(ClientConfig cfg, Provider provider); 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/handler/provider/AbstractProviderFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.handler.provider; 17 | 18 | import com.meituan.dorado.common.Constants; 19 | import com.meituan.dorado.common.RpcRole; 20 | import com.meituan.dorado.rpc.handler.filter.Filter; 21 | 22 | public abstract class AbstractProviderFilter implements Filter { 23 | 24 | @Override 25 | public RpcRole getRole() { 26 | return RpcRole.PROVIDER; 27 | } 28 | 29 | @Override 30 | public int getPriority() { 31 | return Constants.DEFAULT_FILTER_PRIORITY; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/meta/RpcResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.meta; 17 | 18 | public class RpcResult { 19 | 20 | private Object returnVal; 21 | 22 | public RpcResult(){} 23 | 24 | public RpcResult(Object returnVal) { 25 | this.returnVal = returnVal; 26 | } 27 | 28 | public Object getReturnVal() { 29 | return returnVal; 30 | } 31 | 32 | public void setReturnVal(Object returnVal) { 33 | this.returnVal = returnVal; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "RpcResult{" + 39 | "returnVal=" + returnVal + 40 | '}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/rpc/proxy/ProxyFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.rpc.proxy; 17 | 18 | import com.meituan.dorado.cluster.ClusterHandler; 19 | import com.meituan.dorado.common.extension.SPI; 20 | 21 | @SPI 22 | public interface ProxyFactory { 23 | 24 | T getProxy(ClusterHandler handler); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/serialize/Serializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.serialize; 17 | 18 | import com.meituan.dorado.common.exception.ProtocolException; 19 | 20 | public interface Serializer { 21 | 22 | byte[] serialize(Object obj) throws ProtocolException; 23 | 24 | Object deserialize(byte[] bytes, Class clz) throws ProtocolException; 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/serialize/protostuff/ProtostuffSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.serialize.protostuff; 17 | 18 | import com.meituan.dorado.common.exception.ProtocolException; 19 | import com.meituan.dorado.serialize.Serializer; 20 | 21 | public class ProtostuffSerializer implements Serializer { 22 | 23 | @Override 24 | public byte[] serialize(Object obj) throws ProtocolException { 25 | return new byte[0]; 26 | } 27 | 28 | @Override 29 | public Object deserialize(byte[] bytes, Class clz) throws ProtocolException { 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/serialize/thrift/ThriftSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.serialize.thrift; 17 | 18 | import com.meituan.dorado.common.exception.ProtocolException; 19 | import com.meituan.dorado.serialize.Serializer; 20 | 21 | public class ThriftSerializer implements Serializer { 22 | 23 | @Override 24 | public byte[] serialize(Object obj) throws ProtocolException { 25 | return new byte[0]; 26 | } 27 | 28 | @Override 29 | public Object deserialize(byte[] bytes, Class clz) throws ProtocolException { 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/trace/InvokeTrace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.trace; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.rpc.meta.RpcInvocation; 20 | import com.meituan.dorado.trace.meta.TraceParam; 21 | 22 | @SPI 23 | public interface InvokeTrace { 24 | 25 | String getName(); 26 | 27 | void init(String appkey); 28 | 29 | void clientSend(TraceParam traceParam, RpcInvocation invocation); 30 | 31 | void clientRecv(TraceParam traceParam, RpcInvocation invocation); 32 | 33 | void serverRecv(TraceParam traceParam, RpcInvocation invocation); 34 | 35 | void serverSend(TraceParam traceParam, RpcInvocation invocation); 36 | } 37 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/trace/meta/TraceStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.trace.meta; 17 | 18 | public enum TraceStatus { 19 | SUCCESS(0), 20 | EXCEPTION(1), 21 | TIMEOUT(2), 22 | DROP(3), 23 | HTTP_2XX(12), 24 | HTTP_3XX(13), 25 | HTTP_4XX(14), 26 | HTTP_5XX(15); 27 | 28 | private int value; 29 | 30 | private TraceStatus(int i) { 31 | this.value = i; 32 | } 33 | 34 | public int getValue() { 35 | return this.value; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/transport/AbstractClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport; 17 | 18 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 19 | 20 | public abstract class AbstractClientFactory implements ClientFactory { 21 | 22 | public boolean isInvokerHasClient(Invoker invoker) { 23 | return invoker.getClient() != null && !invoker.getClient().isClosed(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/transport/ClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.config.service.ClientConfig; 20 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 21 | 22 | @SPI 23 | public interface ClientFactory { 24 | 25 | Client buildClient(ClientConfig config, Invoker invoker); 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/transport/LengthDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | 20 | import java.nio.ByteBuffer; 21 | 22 | @SPI 23 | public interface LengthDecoder { 24 | 25 | /** 26 | * 从数据源中解析本次会话所需的数据size 27 | * 28 | * @param in 数据源 29 | * @return 所需数据长度,负值表示不合法的情况 30 | */ 31 | int decodeLength(ByteBuffer in); 32 | } 33 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/transport/ServerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport; 17 | 18 | import com.meituan.dorado.common.extension.SPI; 19 | import com.meituan.dorado.config.service.ProviderConfig; 20 | 21 | @SPI 22 | public interface ServerFactory { 23 | 24 | Server buildServer(ProviderConfig configuration); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/transport/http/HttpServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport.http; 17 | 18 | import com.meituan.dorado.rpc.handler.http.HttpHandler; 19 | 20 | import java.net.InetSocketAddress; 21 | 22 | public interface HttpServer { 23 | 24 | /** 25 | * 获取本地地址 26 | * @return 27 | */ 28 | InetSocketAddress getLocalAddress(); 29 | 30 | /** 31 | * 获取handler 32 | */ 33 | HttpHandler getHttpHandler(); 34 | 35 | /** 36 | * 关闭server 37 | */ 38 | void close(); 39 | 40 | boolean isStart(); 41 | } 42 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/transport/http/HttpServerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport.http; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.common.extension.SPI; 20 | 21 | @SPI 22 | public interface HttpServerFactory { 23 | 24 | HttpServer buildServer(RpcRole rpcRole); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/java/com/meituan/dorado/util/ChecksumUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.util; 17 | 18 | 19 | import java.util.zip.Adler32; 20 | 21 | public class ChecksumUtil { 22 | 23 | public static byte[] genAdler32ChecksumBytes(byte[] bytes) { 24 | Adler32 a32 = new Adler32(); 25 | a32.update(bytes, 0, bytes.length); 26 | int sum = (int) a32.getValue(); 27 | byte[] checksum = new byte[4]; 28 | checksum[0] = (byte) (sum >> 24); 29 | checksum[1] = (byte) (sum >> 16); 30 | checksum[2] = (byte) (sum >> 8); 31 | checksum[3] = (byte) (sum); 32 | return checksum; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/main/resources/dorado-application.properties: -------------------------------------------------------------------------------- 1 | dorado.version=${dorado.version} -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/HelloService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado; 17 | 18 | 19 | public interface HelloService { 20 | 21 | String sayHello(String message); 22 | 23 | interface Iface { 24 | String sayHello(String message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado; 17 | 18 | 19 | public class HelloServiceImpl implements HelloService { 20 | 21 | @Override 22 | public String sayHello(String message) { 23 | return message; 24 | } 25 | } -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.config.service.ClientConfig; 19 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 20 | import com.meituan.dorado.transport.Client; 21 | import com.meituan.dorado.transport.ClientFactory; 22 | 23 | 24 | public class MockClientFactory implements ClientFactory { 25 | 26 | @Override 27 | public Client buildClient(ClientConfig config, Invoker invoker) { 28 | return new MockClient(config, invoker); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.codec.Codec; 20 | import com.meituan.dorado.transport.Channel; 21 | 22 | import java.io.IOException; 23 | import java.util.Map; 24 | 25 | public class MockCodec implements Codec { 26 | 27 | @Override 28 | public byte[] encode(Channel channel, Object message, Map attachments) { 29 | return new byte[0]; 30 | } 31 | 32 | @Override 33 | public Object decode(Channel channel, byte[] buffer, Map attachments) { 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockFilterHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.filter.FilterHandler; 20 | import com.meituan.dorado.rpc.meta.RpcInvocation; 21 | import com.meituan.dorado.rpc.meta.RpcResult; 22 | 23 | public class MockFilterHandler implements FilterHandler { 24 | 25 | @Override 26 | public RpcResult handle(RpcInvocation invocation) throws Throwable { 27 | return new RpcResult(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockHttpServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.transport.http.AbstractHttpServer; 20 | 21 | import java.net.InetSocketAddress; 22 | 23 | public class MockHttpServer extends AbstractHttpServer { 24 | 25 | public MockHttpServer(RpcRole role) { 26 | super(role); 27 | } 28 | 29 | @Override 30 | protected void doStart() { 31 | bindPort(); 32 | } 33 | 34 | @Override 35 | protected void doBind(InetSocketAddress localAddress) { 36 | 37 | } 38 | 39 | @Override 40 | protected void doClose() { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockInvokerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.config.service.ClientConfig; 20 | import com.meituan.dorado.registry.meta.Provider; 21 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 22 | import com.meituan.dorado.rpc.handler.invoker.InvokerFactory; 23 | 24 | public class MockInvokerFactory implements InvokerFactory{ 25 | 26 | @Override 27 | public Invoker buildInvoker(ClientConfig config, Provider provider) { 28 | return new MockInvoker(provider, config.getServiceInterface()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockInvokerFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.filter.FilterHandler; 20 | import com.meituan.dorado.rpc.handler.invoker.AbstractInvokerFilter; 21 | import com.meituan.dorado.rpc.meta.RpcInvocation; 22 | import com.meituan.dorado.rpc.meta.RpcResult; 23 | 24 | public class MockInvokerFilter extends AbstractInvokerFilter { 25 | 26 | @Override 27 | public RpcResult filter(RpcInvocation invocation, FilterHandler nextHandler) throws Throwable { 28 | return new RpcResult(); 29 | } 30 | 31 | @Override 32 | public int getPriority() { 33 | return 2; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockInvokerTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.rpc.handler.invoker.AbstractInvokerTraceFilter; 19 | import com.meituan.dorado.trace.meta.TraceParam; 20 | import com.meituan.dorado.trace.meta.TraceTimeline; 21 | import com.meituan.dorado.transport.meta.Request; 22 | 23 | public class MockInvokerTraceFilter extends AbstractInvokerTraceFilter { 24 | 25 | @Override 26 | protected TraceParam genTraceParam(Request request, TraceTimeline timeline) { 27 | return new TraceParam(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockLoadBalance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.cluster.loadbalance.AbstractLoadBalance; 20 | import com.meituan.dorado.rpc.handler.invoker.Invoker; 21 | 22 | import java.util.List; 23 | 24 | public class MockLoadBalance extends AbstractLoadBalance { 25 | 26 | @Override 27 | protected Invoker doSelect(List> invokers) { 28 | return invokers.get(0); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockProviderFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.rpc.handler.filter.FilterHandler; 20 | import com.meituan.dorado.rpc.handler.provider.AbstractProviderFilter; 21 | import com.meituan.dorado.rpc.meta.RpcInvocation; 22 | import com.meituan.dorado.rpc.meta.RpcResult; 23 | 24 | public class MockProviderFilter extends AbstractProviderFilter { 25 | 26 | @Override 27 | public RpcResult filter(RpcInvocation invocation, FilterHandler nextHandler) throws Throwable { 28 | return new RpcResult(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockProviderTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | import com.meituan.dorado.rpc.handler.provider.AbstractProviderTraceFilter; 19 | import com.meituan.dorado.trace.meta.TraceParam; 20 | import com.meituan.dorado.trace.meta.TraceTimeline; 21 | import com.meituan.dorado.transport.meta.Request; 22 | 23 | public class MockProviderTraceFilter extends AbstractProviderTraceFilter { 24 | 25 | @Override 26 | protected TraceParam genTraceParam(Request request, TraceTimeline timeline) { 27 | return new TraceParam(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/mock/MockRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.mock; 17 | 18 | 19 | import com.meituan.dorado.registry.Registry; 20 | import com.meituan.dorado.registry.RegistryPolicy; 21 | 22 | public class MockRegistry implements Registry { 23 | 24 | @Override 25 | public void destroy() {} 26 | 27 | @Override 28 | public void setRegistryPolicy(RegistryPolicy registryPolicy) {} 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/transport/http/HttpServerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport.http; 17 | 18 | 19 | import com.meituan.dorado.common.RpcRole; 20 | import com.meituan.dorado.mock.MockHttpServer; 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | 24 | public class HttpServerTest { 25 | 26 | @Test 27 | public void testHttpServer() { 28 | 29 | MockHttpServer server = new MockHttpServer(RpcRole.INVOKER); 30 | Assert.assertTrue(server.isStart()); 31 | 32 | server.close(); 33 | Assert.assertTrue(!server.isStart()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/java/com/meituan/dorado/util/ChecksumUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.util; 17 | 18 | 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | public class ChecksumUtilTest { 23 | 24 | @Test 25 | public void testGenAdler32ChecksumBytes() { 26 | String message = "test dorado checksum"; 27 | byte[] checksum = ChecksumUtil.genAdler32ChecksumBytes(message.getBytes()); 28 | byte[] result = {(byte)81,(byte)12,(byte)7,(byte)-51}; 29 | Assert.assertArrayEquals(checksum, result); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.check.http.HttpCheckHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockHttpCheckHandler -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.cluster.Cluster: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockCluster -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.cluster.LoadBalance: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.loadbalance.RandomLoadBalance 2 | com.meituan.dorado.cluster.loadbalance.RoundRobinLoadBalance 3 | com.meituan.dorado.mock.MockLoadBalance -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.cluster.Router: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.cluster.router.NoneRouter -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.codec.Codec: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockCodec -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockRegistryFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.HandlerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockHandlerFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.InvokeHandler: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockInvokeHandler -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.filter.Filter: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.handler.filter.ClientQpsLimitFilter 2 | com.meituan.dorado.rpc.handler.filter.InvokerFilter 3 | com.meituan.dorado.rpc.handler.filter.TraceTestFilter 4 | 5 | #重复添加没有只会构造一个 6 | com.meituan.dorado.rpc.handler.filter.ClientQpsLimitFilter 7 | com.meituan.dorado.rpc.handler.filter.InvokerFilter 8 | com.meituan.dorado.rpc.handler.filter.TraceTestFilter 9 | com.meituan.dorado.rpc.handler.filter.ServerQpsLimitFilter 10 | com.meituan.dorado.rpc.handler.filter.ProviderFilter 11 | 12 | -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.invoker.InvokerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockInvokerFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.rpc.proxy.ProxyFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.rpc.proxy.jdk.JdkProxyFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.trace.InvokeTrace: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockInvokeTrace -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.transport.ClientFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockClientFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.transport.ServerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockServerFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/META-INF/services/com.meituan.dorado.transport.http.HttpServerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.mock.MockHttpServerFactory -------------------------------------------------------------------------------- /dorado/dorado-core/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/QuitOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo; 17 | 18 | public interface QuitOperation { 19 | 20 | void prepareQuit(); 21 | } 22 | -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/annotation/ThriftProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo.thrift.annotation; 17 | 18 | import com.meituan.dorado.demo.ConsoleCommandProcessor; 19 | import org.springframework.context.support.ClassPathXmlApplicationContext; 20 | 21 | public class ThriftProvider { 22 | 23 | public static void main(String[] args) throws Exception { 24 | ClassPathXmlApplicationContext beanFactory = new ClassPathXmlApplicationContext("thrift/annotation/thrift-provider.xml"); 25 | ConsoleCommandProcessor.processCommands(beanFactory); 26 | } 27 | } -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/async/ThriftProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo.thrift.async; 17 | 18 | import com.meituan.dorado.demo.ConsoleCommandProcessor; 19 | import org.springframework.context.support.ClassPathXmlApplicationContext; 20 | 21 | public class ThriftProvider { 22 | 23 | public static void main(String[] args) throws Exception { 24 | ClassPathXmlApplicationContext beanFactory = new ClassPathXmlApplicationContext("thrift/async/thrift-provider-async.xml"); 25 | ConsoleCommandProcessor.processCommands(beanFactory); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/multiport/ThriftProviderMultiPort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo.thrift.multiport; 17 | 18 | 19 | import com.meituan.dorado.demo.ConsoleCommandProcessor; 20 | import org.springframework.context.support.ClassPathXmlApplicationContext; 21 | 22 | public class ThriftProviderMultiPort { 23 | 24 | public static void main(String[] args) throws Exception { 25 | ClassPathXmlApplicationContext beanFactory = new ClassPathXmlApplicationContext("thrift/multiport/thrift-provider-multiport.xml"); 26 | 27 | ConsoleCommandProcessor.processCommands(beanFactory); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/simple/ThriftProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo.thrift.simple; 17 | 18 | 19 | import com.meituan.dorado.demo.ConsoleCommandProcessor; 20 | import org.springframework.context.support.ClassPathXmlApplicationContext; 21 | 22 | public class ThriftProvider { 23 | 24 | public static void main(String[] args) throws Exception { 25 | ClassPathXmlApplicationContext beanFactory = new ClassPathXmlApplicationContext("thrift/simple/thrift-provider.xml"); 26 | ConsoleCommandProcessor.processCommands(beanFactory); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/java/com/meituan/dorado/demo/thrift/zkregistry/ThriftProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo.thrift.zkregistry; 17 | 18 | import com.meituan.dorado.demo.ConsoleCommandProcessor; 19 | import org.springframework.context.support.ClassPathXmlApplicationContext; 20 | 21 | /** 22 | * 注意此方式需要在配置thrift/zkregistry/thrift-provider.xml中配置你的zk服务地址 23 | */ 24 | public class ThriftProvider { 25 | 26 | public static void main(String[] args) throws Exception { 27 | ClassPathXmlApplicationContext beanFactory = new ClassPathXmlApplicationContext("thrift/zkregistry/thrift-provider.xml"); 28 | ConsoleCommandProcessor.processCommands(beanFactory); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dorado/dorado-demo/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dorado/dorado-doc/img/ThriftFileExample.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/dorado/dorado-doc/img/ThriftFileExample.tiff -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-developer/Version.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dorado 版本管理 3 | 4 | ### 1.版本号管理 5 | 6 | Dorado的版本号管理参照 : http://semver.org/lang/zh-CN/ 进行设定,版本格式为:主版本号.次版本号.修订号 7 | 8 | 主版本号:Dorado提供的API出现不兼容的情况时,升级该版本号 9 | 10 | 次版本号:Dorado提供新的功能特性同时保持向下兼容时,升级该版本号 11 | 12 | 修订号:Dorado的代码进行向下兼容的问题修复时,升级该版本号 13 | 14 | ### 2. 版本维护 15 | 16 | 如果Dorado目前的版本为 1.2.0,此时会对 1.1.X 的相关版本进行维护,低于该版本(比如:1.0.5)不再进行管理 17 | 18 | -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-thrift/api/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.demo.thrift.api; 17 | 18 | import org.apache.thrift.TException; 19 | 20 | public class HelloServiceImpl implements HelloService.Iface { 21 | @Override 22 | public String sayHello(String name) { 23 | String result = "Hello " + name; 24 | return result; 25 | } 26 | 27 | @Override 28 | public String sayBye(String username) throws TException { 29 | return "Bye " + username; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-user/DirectInvoke.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dorado 直连 3 | 4 | 为了方便进行服务测试和问题定位,Dorado 支持指定地址进行调用的场景。使用方式如下,设置直连地址即可 5 | 6 | ```xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | ``` 14 | -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-user/LoadBalance.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dorado 负载均衡 3 | 4 | Dorado目前提供两种负载均衡策略 5 | - 使用者也可以通过SPI扩展自己的LoadBalance 6 | - 框架通过SPI接口前缀判断使用的负载均衡策略 7 | 8 | | 算法 | 名称 | 说明 | 9 | | ------ | ------ | ------ | 10 | | RoundRobinLoadBalance | 带权的RoundRobin轮询算法 | 按照节点的权重依次选择每个节点 | 11 | | RandomLoadBalance | 带权的随机轮询算法 | 按照节点的权重随机选择某个节点 | 12 | 13 | 14 | ### 1.配置方式 15 | 16 | #### 1.1 xml文件方式 17 | 18 | ```xml 19 | 20 | 21 | 22 | 23 | ``` 24 | 25 | #### 1.2 API方式 26 | 27 | ```java 28 | ReferenceConfig config = new ReferenceConfig(); 29 | // ...省略其他配置... 30 | config.setLoadBalancePolicy("roundRobin"); 31 | ``` -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-user/MethodTimeout.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dorado 方法级别超时 3 | 4 | Dorado支持对方法级别的超时时间设置,默认使用统一的值 5 | 6 | ### 1. XML配置方式 7 | 8 | ```xml 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ``` 20 | 21 | ### 2.API配置方式 22 | 23 | ```java 24 | ReferenceConfig config = new ReferenceConfig<>(); 25 | config.setAppkey("com.meituan.octo.dorado.client"); 26 | config.setRemoteAppkey("com.meituan.octo.dorado.server"); 27 | config.setServiceInterface(HelloService.class); 28 | Map methodTimeout = new HashMap<>(); 29 | methodTimeout.put("sayHello", 1000); 30 | methodTimeout.put("sayBye", 2000); 31 | config.setMethodTimeout(methodTimeout); 32 | ``` 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-user/ShutdownGracefully.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dorado 优雅关闭 3 | 4 | Dorado的优雅关闭通过ShutDownHook方式实现,调用端和服务端通过添加hook进行资源的清理和关闭 5 | 6 | ```java 7 | protected synchronized void addShutDownHook() { 8 | if (hook == null) { 9 | hook = new ShutDownHook(this); 10 | Runtime.getRuntime().addShutdownHook(hook); 11 | } 12 | } 13 | 14 | class ShutDownHook extends Thread { 15 | private ReferenceConfig config; 16 | 17 | public ShutDownHook(ReferenceConfig config) { 18 | this.config = config; 19 | } 20 | 21 | @Override 22 | public void run() { 23 | hook = null; 24 | config.destroy(); 25 | } 26 | } 27 | ``` -------------------------------------------------------------------------------- /dorado/dorado-doc/manual-user/WeightWarmUp.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dorado 服务节点预热 3 | 4 |         Java编译器特性、服务缓存以及一些初始化操作,使服务一般在刚启动时响应较慢。所以服务端启动时如果不想在注册完成后,立即被调用端按照配置权重打入流量,则可以通过设置预热时间让流量慢慢进来,从而减少因服务节点启动带来的耗时长引发失败率可能变高的问题。 5 | 6 |         实现方式是服务端将预热时间写入注册中心,调用端在服务发现后根据预热时间和服务节点启动时间计算出当前时刻的权重,随着时间的增长线性增加该节点的权重,由此达到预热的效果。 7 | 8 | >比如服务端服务节点设置预热时间为180s,权重为120;则调用端在服务端服务发布1min的时候权重为40,2min为80,超过3min之后权重就会恢复为120 9 | 10 | 11 | 使用方式是在服务端配置中设置预热时间,如下所示: 12 | 13 | * API方式 14 | 15 | ```java 16 | ProviderConfig config = new ProviderConfig(); 17 | // ...省略其他配置... 18 | config.setWarmup(180); // 默认单位为s 19 | ``` 20 | 21 | * XML方式 22 | ```xml 23 | 24 | 25 | 26 | 27 | ``` 28 | 29 | -------------------------------------------------------------------------------- /dorado/dorado-protocol/dorado-protocol-octo/src/main/java/com/meituan/dorado/codec/octo/meta/CallType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.meituan.dorado.codec.octo.meta; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum CallType implements org.apache.thrift.TEnum { 15 | Reply(0), 16 | NoReply(1); 17 | 18 | private final int value; 19 | 20 | private CallType(int value) { 21 | this.value = value; 22 | } 23 | 24 | /** 25 | * Get the integer value of this enum value, as defined in the Thrift IDL. 26 | */ 27 | public int getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 33 | * @return null if the value is not found. 34 | */ 35 | public static CallType findByValue(int value) { 36 | switch (value) { 37 | case 0: 38 | return Reply; 39 | case 1: 40 | return NoReply; 41 | default: 42 | return null; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /dorado/dorado-protocol/dorado-protocol-octo/src/main/java/com/meituan/dorado/codec/octo/meta/CompressType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.meituan.dorado.codec.octo.meta; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum CompressType implements org.apache.thrift.TEnum { 15 | None(0), 16 | Snappy(1), 17 | Gzip(2); 18 | 19 | private final int value; 20 | 21 | private CompressType(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static CompressType findByValue(int value) { 37 | switch (value) { 38 | case 0: 39 | return None; 40 | case 1: 41 | return Snappy; 42 | case 2: 43 | return Gzip; 44 | default: 45 | return null; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /dorado/dorado-protocol/dorado-protocol-octo/src/main/java/com/meituan/dorado/codec/octo/meta/MessageType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.meituan.dorado.codec.octo.meta; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum MessageType implements org.apache.thrift.TEnum { 15 | Normal(0), 16 | NormalHeartbeat(1), 17 | ScannerHeartbeat(2); 18 | 19 | private final int value; 20 | 21 | private MessageType(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static MessageType findByValue(int value) { 37 | switch (value) { 38 | case 0: 39 | return Normal; 40 | case 1: 41 | return NormalHeartbeat; 42 | case 2: 43 | return ScannerHeartbeat; 44 | default: 45 | return null; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-mns/src/main/resources/META-INF/services/com.meituan.dorado.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.registry.mns.MnsRegistryFactory -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-mns/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-mock/src/main/resources/META-INF/services/com.meituan.dorado.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.registry.mock.MockRegistryFactory -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-zookeeper/src/main/java/com/meituan/dorado/registry/zookeeper/curator/NodeChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry.zookeeper.curator; 17 | 18 | public interface NodeChangeListener { 19 | 20 | void childNodeAdded(String childPath, String childNodePath); 21 | 22 | void childNodeUpdated(String childPath, String childNodePath); 23 | 24 | void childNodeRemoved(String childPath, String childNodePath); 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-zookeeper/src/main/java/com/meituan/dorado/registry/zookeeper/curator/StateChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry.zookeeper.curator; 17 | 18 | public interface StateChangeListener { 19 | 20 | void connStateChanged(); 21 | } 22 | -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-zookeeper/src/main/java/com/meituan/dorado/registry/zookeeper/util/ServiceDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.registry.zookeeper.util; 17 | 18 | public class ServiceDetail { 19 | 20 | private int unifiedProto; 21 | 22 | public ServiceDetail() { 23 | } 24 | 25 | public ServiceDetail(int unifiedProto) { 26 | this.unifiedProto = unifiedProto; 27 | } 28 | 29 | public int getUnifiedProto() { 30 | return unifiedProto; 31 | } 32 | 33 | public void setUnifiedProto(int unifiedProto) { 34 | this.unifiedProto = unifiedProto; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-zookeeper/src/main/resources/META-INF/services/com.meituan.dorado.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.registry.zookeeper.ZookeeperRegistryFactory -------------------------------------------------------------------------------- /dorado/dorado-registry/dorado-registry-zookeeper/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/annotationTwitter/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.test.thrift.annotationTwitter; 17 | 18 | public class Constants { 19 | 20 | public static final int DEFAULT_AGE = 18; 21 | } -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/annotationTwitter/TweetType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.test.thrift.annotationTwitter; 17 | 18 | import com.facebook.swift.codec.ThriftEnumValue; 19 | 20 | public enum TweetType { 21 | 22 | TWEET(0), 23 | RETWEET(2), 24 | DM(10), 25 | REPLY(11); 26 | 27 | private final int value; 28 | 29 | TweetType(int value) { 30 | this.value = value; 31 | } 32 | 33 | @ThriftEnumValue 34 | public int getValue() { 35 | return value; 36 | } 37 | 38 | 39 | } -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/api/EchoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.test.thrift.api; 17 | 18 | import org.apache.thrift.TException; 19 | 20 | public class EchoImpl implements Echo.Iface { 21 | @Override 22 | public String echo(String messge) throws TException { 23 | return "echo: " + messge; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/api/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.test.thrift.api; 17 | 18 | import org.apache.thrift.TException; 19 | 20 | public class HelloServiceImpl implements HelloService.Iface { 21 | @Override 22 | public String sayHello(String name) { 23 | String result = "Hello " + name; 24 | return result; 25 | } 26 | 27 | @Override 28 | public String sayBye(String username) throws TException { 29 | return "Bye " + username; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/apitwitter/TweetType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.meituan.dorado.test.thrift.apitwitter; 8 | 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | import org.apache.thrift.TEnum; 13 | 14 | public enum TweetType implements org.apache.thrift.TEnum { 15 | TWEET(0), 16 | RETWEET(2), 17 | DM(10), 18 | REPLY(11); 19 | 20 | private final int value; 21 | 22 | private TweetType(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static TweetType findByValue(int value) { 38 | switch (value) { 39 | case 0: 40 | return TWEET; 41 | case 2: 42 | return RETWEET; 43 | case 10: 44 | return DM; 45 | case 11: 46 | return REPLY; 47 | default: 48 | return null; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api/ApiVersion1Impl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meituan.dorado.test.thrift.exception.api; 18 | 19 | import org.apache.thrift.TException; 20 | 21 | public class ApiVersion1Impl implements ApiVersion1.Iface { 22 | @Override 23 | public Result1 send(String message, String param) throws TException { 24 | return new Result1("result1", 100, message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/java/com/meituan/dorado/test/thrift/exception/api/ApiVersion2Impl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meituan.dorado.test.thrift.exception.api; 18 | 19 | import org.apache.thrift.TException; 20 | 21 | public class ApiVersion2Impl implements ApiVersion2.Iface { 22 | @Override 23 | public Result2 send(String message, String param) throws TException { 24 | return new Result2("result2", 100); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/resources/thrift/ApiVersion1.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.meituan.dorado.test.thrift.exception.api 2 | 3 | struct Result1 { 4 | 1: required string result; 5 | 2: required i32 id; 6 | 3: required string message; 7 | } 8 | 9 | service ApiVersion1 { 10 | Result1 send(1:string message, 2:string param) 11 | } -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/resources/thrift/ApiVersion2.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.meituan.dorado.test.thrift.exception.api 2 | 3 | struct Result2 { 4 | 1: required string result; 5 | 2: required i32 id; 6 | } 7 | 8 | service ApiVersion2 { 9 | Result2 send(1:string message, 2:string param) 10 | } -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/resources/thrift/echo.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.meituan.dorado.test.thrift.api 2 | service Echo { 3 | string echo(1:string messge) 4 | } -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-api/src/main/resources/thrift/hello.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.meituan.dorado.test.thrift.api 2 | service HelloService 3 | { 4 | string sayHello(1:string username) 5 | string sayBye(1:string username) 6 | } 7 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-benchmark/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-benchmark/src/test/resources/service.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.meituan.dorado.banchmark.simple.api 2 | service Echo { 3 | string echo(1:string messge) 4 | } -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-client/src/main/resources/META-INF/app.properties: -------------------------------------------------------------------------------- 1 | app.name=com.meituan.octo.dorado.client -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/java/com/sankuai/mtthrift/testSuite/idlTest/ThriftTestConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.sankuai.mtthrift.testSuite.idlTest; 8 | 9 | @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) 10 | public class ThriftTestConstants { 11 | 12 | public static final int DEFAULT_AGE = 18; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/java/com/sankuai/mtthrift/testSuite/idlTest/TweetType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.9.3) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.sankuai.mtthrift.testSuite.idlTest; 8 | 9 | 10 | import org.apache.thrift.TEnum; 11 | 12 | public enum TweetType implements TEnum { 13 | TWEET(0), 14 | RETWEET(2), 15 | DM(10), 16 | REPLY(11); 17 | 18 | private final int value; 19 | 20 | private TweetType(int value) { 21 | this.value = value; 22 | } 23 | 24 | /** 25 | * Get the integer value of this enum value, as defined in the Thrift IDL. 26 | */ 27 | public int getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 33 | * @return null if the value is not found. 34 | */ 35 | public static TweetType findByValue(int value) { 36 | switch (value) { 37 | case 0: 38 | return TWEET; 39 | case 2: 40 | return RETWEET; 41 | case 10: 42 | return DM; 43 | case 11: 44 | return REPLY; 45 | default: 46 | return null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/META-INF/services/com.meituan.dorado.rpc.handler.filter.Filter: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.test.thrift.filter.ClientQpsLimitFilter 2 | com.meituan.dorado.test.thrift.filter.InvokerFilter 3 | 4 | #重复添加没有只会构造一个 5 | com.meituan.dorado.test.thrift.filter.ClientQpsLimitFilter 6 | com.meituan.dorado.test.thrift.filter.InvokerFilter 7 | com.meituan.dorado.test.thrift.filter.ServerQpsLimitFilter 8 | com.meituan.dorado.test.thrift.filter.ProviderFilter 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/business/thrift-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/business/thrift-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/emptyChannel/thrift-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/emptyChannel/thrift-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/processor/thrift-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/processor/thrift-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/protocol/thrift-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/threadpool/thrift-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/transport/thrift-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-integration/src/test/resources/thrift/exception/transport/thrift-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /dorado/dorado-test/dorado-test-server/src/main/resources/META-INF/app.properties: -------------------------------------------------------------------------------- 1 | app.name=com.meituan.octo.dorado.server -------------------------------------------------------------------------------- /dorado/dorado-trace/dorado-trace-cat/src/main/resources/META-INF/services/com.meituan.dorado.trace.InvokeTrace: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.trace.cat.CatInvokeTrace -------------------------------------------------------------------------------- /dorado/dorado-trace/dorado-trace-cat/src/test/resources/META-INF/app.properties: -------------------------------------------------------------------------------- 1 | app.name=com.meituan.octo.dorado.server -------------------------------------------------------------------------------- /dorado/dorado-trace/dorado-trace-cat/src/test/resources/META-INF/services/com.meituan.dorado.trace.InvokeTrace: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.trace.cat.CatInvokeTrace -------------------------------------------------------------------------------- /dorado/dorado-trace/dorado-trace-cat/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-httpnetty/src/main/java/com/meituan/dorado/transport/http/netty/NettyHttpServerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport.http.netty; 17 | 18 | import com.meituan.dorado.common.RpcRole; 19 | import com.meituan.dorado.transport.http.HttpServer; 20 | import com.meituan.dorado.transport.http.HttpServerFactory; 21 | 22 | public class NettyHttpServerFactory implements HttpServerFactory { 23 | 24 | @Override 25 | public HttpServer buildServer(RpcRole rpcRole) { 26 | return NettyHttpServer.buildHttpServer(rpcRole); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-httpnetty/src/main/resources/META-INF/services/com.meituan.dorado.transport.http.HttpServerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.transport.http.netty.NettyHttpServerFactory -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-netty/src/main/java/com/meituan/dorado/transport/netty/NettyServerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Meituan Dianping. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.meituan.dorado.transport.netty; 17 | 18 | import com.meituan.dorado.config.service.ProviderConfig; 19 | import com.meituan.dorado.transport.Server; 20 | import com.meituan.dorado.transport.ServerFactory; 21 | 22 | public class NettyServerFactory implements ServerFactory { 23 | 24 | @Override 25 | public Server buildServer(ProviderConfig serviceConfig) { 26 | return new NettyServer(serviceConfig); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-netty/src/main/resources/META-INF/services/com.meituan.dorado.transport.ClientFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.transport.netty.NettyClientFactory -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-netty/src/main/resources/META-INF/services/com.meituan.dorado.transport.ServerFactory: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.transport.netty.NettyServerFactory -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-netty/src/test/resources/META-INF/services/com.meituan.dorado.codec.Codec: -------------------------------------------------------------------------------- 1 | com.meituan.dorado.codec.octo.DoradoCodec -------------------------------------------------------------------------------- /dorado/dorado-transport/dorado-transport-netty/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /whale/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | if [ $# -ne 1 ] || [ "$1" != "only_lib" -a "$1" != "with_example" -a "$1" != "with_test" -a "$1" != "clean" -a "$1" != "init" ] 6 | then 7 | echo "build.sh + , no argument means all" 8 | exit 9 | fi 10 | 11 | BUILD_NO_EXAMPLES=${BUILD_NO_EXAMPLES:-0} 12 | BUILD_NO_TESTS=${BUILD_NO_TESTS:-0} 13 | 14 | SOURCE_DIR=`pwd` 15 | CPU_CORE_NUM=`cat /proc/cpuinfo | grep processor | wc -l` 16 | 17 | 18 | if [ "$1" == "clean" ] 19 | then 20 | cd tool 21 | sh -x clear4git.sh 22 | cd - 23 | exit 24 | fi 25 | 26 | BUILD_NO_EXAMPLES=1 27 | BUILD_NO_TESTS=1 28 | 29 | if [ "$1" == "with_example" ] 30 | then 31 | BUILD_NO_EXAMPLES=0 32 | elif [ "$1" == "with_test" ] 33 | then 34 | BUILD_NO_TESTS=0 35 | elif [ "$1" == "init" ] 36 | then 37 | cmake -DCMAKE_BUILD_INIT=1 $SOURCE_DIR && make -j"$CPU_CORE_NUM" 38 | cd tool 39 | sh -x clear4git.sh 40 | cd - 41 | exit 42 | fi 43 | 44 | 45 | cmake \ 46 | -DCMAKE_BUILD_NO_EXAMPLES=$BUILD_NO_EXAMPLES \ 47 | -DCMAKE_BUILD_NO_TESTS=$BUILD_NO_TESTS \ 48 | $SOURCE_DIR \ 49 | && make -j"$CPU_CORE_NUM" 50 | 51 | -------------------------------------------------------------------------------- /whale/cmake/CMakeLists.download_gtest.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.10) 2 | 3 | project(googletest-download NONE) 4 | 5 | include(ExternalProject) 6 | ExternalProject_Add(googletest 7 | GIT_REPOSITORY https://github.com/google/googletest.git 8 | GIT_TAG release-1.8.0 9 | SOURCE_DIR "${PROJECT_BINARY_DIR}/googletest-src" 10 | BINARY_DIR "${PROJECT_BINARY_DIR}/googletest-build" 11 | CONFIGURE_COMMAND "" 12 | BUILD_COMMAND "" 13 | INSTALL_COMMAND "" 14 | TEST_COMMAND "" 15 | ) -------------------------------------------------------------------------------- /whale/cmake/DonwloadMuduo.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.10) 2 | 3 | project(muduo-download NONE) 4 | 5 | include(ExternalProject) 6 | ExternalProject_Add(muduo 7 | GIT_REPOSITORY https://github.com/chenshuo/muduo.git 8 | GIT_TAG v1.1.0 9 | SOURCE_DIR "${PROJECT_BINARY_DIR}/muduo" 10 | PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/patch/0001-add-patch-for-http.patch 11 | CMAKE_COMMAND cmake 12 | CMAKE_ARGS "-DCMAKE_BUILD_NO_EXAMPLES=1 -DCMAKE_CXX_FLAGS=-fPIC" 13 | ) 14 | -------------------------------------------------------------------------------- /whale/cmake/FindGtest.cmake: -------------------------------------------------------------------------------- 1 | # FindGtest 2 | # -------- 3 | # 4 | # Find gtest 5 | # 6 | # Find the gtest includes and library. Once done this will define 7 | # 8 | # GTEST_INCLUDE_DIR - where to find gtest include, etc. 9 | # GTEST_LIBRARY - List of libraries when using gtest_base. 10 | # GTEST_FOUND - True if gtest found. 11 | # 12 | set(GTEST_INCLUDE_DIR ${COMMON_LIB_PATH}/googletest/googletest/include) 13 | set(GTEST_LIBRARY ${COMMON_LIB_PATH}/googletest/googlemock/gtest/libgtest.a ${COMMON_LIB_PATH}/googletest/googlemock/gtest/libgtest_main.a) 14 | set(GTEST_MOCK_LIBRARY ${COMMON_LIB_PATH}/googletest/googlemock/libmock.a ${COMMON_LIB_PATH}/googletest/googlemock/gtest/libmock_main.a) 15 | 16 | #message(${GTEST_INCLUDE_DIR}) 17 | find_path(GTEST_INCLUDE_DIR NAMES gtest) 18 | 19 | mark_as_advanced(GTEST_LIBRARY GTEST_MOCK_LIBRARY GTEST_INCLUDE_DIR) 20 | 21 | # handle the QUIETLY and REQUIRED arguments and set GTEST_FOUND to TRUE if 22 | # all listed variables are TRUE 23 | include(FindPackageHandleStandardArgs) 24 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gtest REQUIRED_VARS GTEST_LIBRARY GTEST_MOCK_LIBRARY GTEST_INCLUDE_DIR) 25 | 26 | if(GTEST_FOUND) 27 | set(GTEST_INCLUDE_DIR ${GTEST_INCLUDE_DIR}) 28 | set(GTEST_LIBRARY ${GTEST_LIBRARY}) 29 | set(GTEST_MOCK_LIBRARY ${GTEST_MOCK_LIBRARY}) 30 | endif() 31 | 32 | -------------------------------------------------------------------------------- /whale/cmake/FindMuduo.cmake: -------------------------------------------------------------------------------- 1 | # FindMuduo 2 | # -------- 3 | # 4 | # Find Muduo 5 | # 6 | # Find the Muduo includes and library. Once done this will define 7 | # 8 | # MUDUO_INCLUDE_DIR - where to find gtest include, etc. 9 | # MUDUO_LIBRARY - List of libraries when using muduo_base. 10 | # MUDUO_FOUND - True if muduo found. 11 | # 12 | 13 | 14 | 15 | set(MUDUO_INCLUDE_DIR_S /usr/local/include) 16 | set(MUDUO_LIBRARY_S /usr/local/lib/) 17 | 18 | find_path(MUDUO_INCLUDE_DIR NAMES muduo PATHS ${MUDUO_INCLUDE_DIR_S}) 19 | find_library(MUDUO_LIBRARY NAMES libmuduo_base.a PATHS ${MUDUO_LIBRARY_S}) 20 | 21 | mark_as_advanced(MUDUO_LIBRARY MUDUO_INCLUDE_DIR) 22 | 23 | # handle the QUIETLY and REQUIRED arguments and set MUDUO_FOUND to TRUE if 24 | # all listed variables are TRUE 25 | include(FindPackageHandleStandardArgs) 26 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUDUO REQUIRED_VARS MUDUO_LIBRARY MUDUO_INCLUDE_DIR) 27 | 28 | MESSAGE("MUDUO_INCLUDE_DIR ${MUDUO_INCLUDE_DIR}") 29 | MESSAGE("MUDUO_LIBRARY ${MUDUO_LIBRARY}") 30 | 31 | if(MUDUO_FOUND) 32 | set(MUDUO_INCLUDE_DIR ${MUDUO_INCLUDE_DIR}) 33 | set(MUDUO_LIBRARY ${MUDUO_LIBRARY}) 34 | else() 35 | MESSAGE("MUDUO_FOUND NO FOUND Download and compile") 36 | include(DonwloadMuduo) 37 | endif() -------------------------------------------------------------------------------- /whale/cmake/FindThrift.cmake: -------------------------------------------------------------------------------- 1 | # FindThrift 2 | # -------- 3 | # 4 | # Find thrift 5 | # 6 | # Find the thrift includes and library. Once done this will define 7 | # 8 | # THRIFT_INCLUDE_DIR - where to find cthrift include, etc. 9 | # THRIFT_LIBRARY - List of libraries when using thrift_base. 10 | # THRIFT_FOUND - True if thrift found. 11 | # 12 | 13 | 14 | set(THRIFT_INCLUDE_DIR_S /usr/include) 15 | set(THRIFT_INCLUDE_DIR_S /usr/lib64/) 16 | 17 | find_path(THRIFT_INCLUDE_DIR NAMES thrift/ PATHS ${THRIFT_INCLUDE_DIR_S}) 18 | find_library(THRIFT_LIBRARY NAMES libthrift.a PATHS ${THRIFT_INCLUDE_DIR_S}) 19 | 20 | mark_as_advanced(THRIFT_INCLUDE_DIR THRIFT_LIBRARY) 21 | 22 | # handle the QUIETLY and REQUIRED arguments and set MUDUO_FOUND to TRUE if 23 | # all listed variables are TRUE 24 | include(FindPackageHandleStandardArgs) 25 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(THRIFT REQUIRED_VARS THRIFT_INCLUDE_DIR THRIFT_LIBRARY) 26 | 27 | MESSAGE("THRIFT_LIBRARY ${THRIFT_LIBRARY}") 28 | MESSAGE("THRIFT_LIBRARY_DIR ${THRIFT_LIBRARY_DIR}") 29 | MESSAGE("THRIFT_INCLUDE_DIR ${THRIFT_INCLUDE_DIR}") 30 | 31 | if(THRIFT_FOUND) 32 | set(THRIFT_INCLUDE_DIR ${THRIFT_INCLUDE_DIR}) 33 | set(THRIFT_LIBRARY ${THRIFT_LIBRARY}) 34 | else() 35 | MESSAGE("THRIFT_FOUND NO FOUND") 36 | endif() -------------------------------------------------------------------------------- /whale/cmake/SetupGtest.cmake: -------------------------------------------------------------------------------- 1 | # Setup googletest 2 | configure_file("${PROJECT_SOURCE_DIR}/cmake/CMakeLists.download_gtest.in" ${PROJECT_BINARY_DIR}/googletest-download/CMakeLists.txt) 3 | 4 | execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . 5 | RESULT_VARIABLE result 6 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download 7 | ) 8 | if(result) 9 | message(FATAL_ERROR "CMake step for googletest failed: ${result}") 10 | endif() 11 | 12 | execute_process(COMMAND ${CMAKE_COMMAND} --build . 13 | RESULT_VARIABLE result 14 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download 15 | ) 16 | if(result) 17 | message(FATAL_ERROR "Build step for googletest failed: ${result}") 18 | endif() 19 | 20 | set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) 21 | 22 | add_subdirectory(${PROJECT_BINARY_DIR}/googletest-src 23 | ${PROJECT_BINARY_DIR}/googletest-build 24 | EXCLUDE_FROM_ALL) -------------------------------------------------------------------------------- /whale/cmake/module.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | function(cthrift_add_test test_name command_line) 4 | # message("argv=${ARGV}, argn=${ARGN}") 5 | add_test(${test_name} ${command_line} ${ARGN}) 6 | # add_test(NAME ${test_name} COMMAND ${command_line} ${ARGN}) 7 | #set_tests_properties(${test_name} PROPERTIES ENVIRONMENT) 8 | endfunction(cthrift_add_test) 9 | 10 | -------------------------------------------------------------------------------- /whale/cthrift/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | SET(CTHRIFT_SRC 4 | cthrift_svr.cc 5 | cthrift_name_service.cc 6 | cthrift_transport.cc 7 | cthrift_client_worker.cc 8 | cthrift_client.cc 9 | cthrift_client_channel.cc 10 | ) 11 | 12 | SET(MNS_ZK_SRC 13 | util/cthrift_mns_imp.cc 14 | util/cthrift_config.cc 15 | util/cthrift_common.cc 16 | util/cthrift_ns_imp.cc 17 | util/cthrift_zk_client.cc 18 | util/zk_tools.cc 19 | util/zk_client.cc 20 | util/log4cplus.cc 21 | ) 22 | 23 | ADD_LIBRARY(cthrift STATIC ${CTHRIFT_SRC} ${MNS_ZK_SRC}) 24 | ADD_LIBRARY(cthrift_dynamic SHARED ${CTHRIFT_SRC} ${MNS_ZK_SRC}) 25 | 26 | SET_TARGET_PROPERTIES(cthrift_dynamic PROPERTIES OUTPUT_NAME "cthrift") 27 | 28 | EXECUTE_PROCESS(COMMAND find ${CTHRIFT_SRC_PATH}/cthrift -path ${CTHRIFT_SRC_PATH}/cthrift/util -prune -o -name *.h -exec cp -t ${INCLUDE_CTHRIFT_OUTPUT_PATH} {} \;) 29 | EXECUTE_PROCESS(COMMAND find ${CTHRIFT_SRC_PATH}/cthrift -path ${CTHRIFT_SRC_PATH}/cthrift/util -prune -o -name *.tcc -exec cp -t ${INCLUDE_CTHRIFT_OUTPUT_PATH} {} \;) 30 | 31 | EXECUTE_PROCESS(COMMAND find ${CTHRIFT_SRC_PATH}/cthrift/util -name *.h -exec cp -t ${INCLUDE_UTIL_OUTPUT_PATH} {} \;) 32 | 33 | if (NOT CMAKE_BUILD_NO_TESTS) 34 | ADD_SUBDIRECTORY(tests) 35 | endif () 36 | -------------------------------------------------------------------------------- /whale/cthrift/tests/conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "ns": { 3 | "origin": "10.24.41.248:2188", 4 | "ismns": 0, 5 | "env":"test" 6 | }, 7 | "client.Appkey": "com.sankuai.inf.newct.client", 8 | "server.Version": "3.0.0", 9 | "server.ListenPort": 16888, 10 | "server.Appkey": "com.sankuai.inf.newct", 11 | "server.register": 1, 12 | "server.WorkThreadNum": 4, 13 | "server.MaxConnNum": 10000, 14 | "server.ServerTimeOut": 100, 15 | "server.ConnGCTime": 10, 16 | "server.ConnThreadNum": 4 17 | } 18 | -------------------------------------------------------------------------------- /whale/cthrift/tests/cthrift_common_unittest.cc: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Created by huixiangbo on 2017/10/12. 4 | // 5 | 6 | #include 7 | #include 8 | #include 9 | #define private public 10 | #define protected public 11 | #include 12 | #undef private 13 | #undef protected 14 | 15 | using namespace std; 16 | using namespace meituan_cthrift; 17 | 18 | class CThriftCommonTest : public testing::Test { 19 | public: 20 | CThriftCommonTest() { 21 | 22 | } 23 | ~CThriftCommonTest() { 24 | 25 | } 26 | virtual void SetUp() { 27 | } 28 | virtual void TearDown() { 29 | } 30 | public: 31 | }; 32 | 33 | TEST_F(CThriftCommonTest, Handle_ValidatePort) { 34 | EXPECT_TRUE(ValidatePort(200)); 35 | } 36 | 37 | TEST_F(CThriftCommonTest, Handle_GetStringLimit) { 38 | EXPECT_TRUE (GetStringLimit() == 16 * 1024 * 1024); 39 | } 40 | 41 | TEST_F(CThriftCommonTest, Handle_strToLower) { 42 | std::string str_ret_high = "LOW"; 43 | std::string str_ret_low = "low"; 44 | std::string str_ret_ret = StrToLower(str_ret_high); 45 | EXPECT_TRUE(str_ret_ret == str_ret_low); 46 | } 47 | 48 | TEST_F(CThriftCommonTest, Handle_CheckDoubleEqual) { 49 | EXPECT_TRUE(CheckDoubleEqual(200.0, 200.0)); 50 | } 51 | -------------------------------------------------------------------------------- /whale/cthrift/tests/cthrift_util_zk_tools_unittest.cc: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Created by huixiangbo on 2017/10/12. 4 | // 5 | 6 | #include 7 | #include 8 | #include 9 | #define private public 10 | #define protected public 11 | #include 12 | #undef private 13 | #undef protected 14 | 15 | using namespace std; 16 | using namespace meituan_cthrift; 17 | 18 | class ZkToolsTest : public testing::Test { 19 | public: 20 | ZkToolsTest() { 21 | p_zk_tools_ = new ZkTools(); 22 | } 23 | ~ZkToolsTest() { 24 | if (p_zk_tools_) { 25 | delete p_zk_tools_; 26 | } 27 | } 28 | virtual void SetUp() { 29 | } 30 | virtual void TearDown() { 31 | } 32 | public: 33 | ZkTools *p_zk_tools_; 34 | }; 35 | -------------------------------------------------------------------------------- /whale/cthrift/tests/echo.thrift: -------------------------------------------------------------------------------- 1 | namespace cpp echo 2 | namespace py echo 3 | namespace java echo 4 | 5 | enum TweetType { 6 | TWEET, 7 | RETWEET = 2, 8 | DM = 0xa, 9 | REPLY 10 | } 11 | 12 | struct test{ 13 | 1: required string arg, 14 | 2: required double arg2, 15 | 3: required list arg3, 16 | 4: required map arg4, 17 | 5: required bool arg5, 18 | 6: required set arg6, 19 | 7: required i32 arg7, 20 | 8: required TweetType arg8, 21 | } 22 | 23 | service Echo 24 | { 25 | string echo(1: string arg,2:test arg2); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /whale/cthrift/tests/echo/Echo_async_server.skeleton.cpp: -------------------------------------------------------------------------------- 1 | // This autogenerated skeleton file illustrates one way to adapt a synchronous 2 | // interface into an asynchronous interface. You should copy it to another 3 | // filename to avoid overwriting it and rewrite as asynchronous any functions 4 | // that would otherwise introduce unwanted latency. 5 | 6 | #include "Echo.h" 7 | #include 8 | #include 9 | 10 | using namespace ::apache::thrift; 11 | using namespace ::apache::thrift::protocol; 12 | using namespace ::apache::thrift::transport; 13 | using namespace ::apache::thrift::async; 14 | 15 | using boost::shared_ptr; 16 | 17 | using namespace ::echo; 18 | 19 | class EchoAsyncHandler : public EchoCobSvIf { 20 | public: 21 | EchoAsyncHandler() { 22 | syncHandler_ = std::auto_ptr(new EchoHandler); 23 | // Your initialization goes here 24 | } 25 | virtual ~EchoAsyncHandler(); 26 | 27 | void echo(std::tr1::function cob, const std::string& arg, const test& arg2) { 28 | std::string _return = ""; 29 | syncHandler_->echo(_return, arg, arg2); 30 | return cob(_return); 31 | } 32 | 33 | protected: 34 | std::auto_ptr syncHandler_; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /whale/cthrift/tests/echo/echo_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "echo_constants.h" 8 | 9 | namespace echo { 10 | 11 | const echoConstants g_echo_constants; 12 | 13 | echoConstants::echoConstants() { 14 | } 15 | 16 | } // namespace 17 | 18 | -------------------------------------------------------------------------------- /whale/cthrift/tests/echo/echo_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef echo_CONSTANTS_H 8 | #define echo_CONSTANTS_H 9 | 10 | #include "echo_types.h" 11 | 12 | namespace echo { 13 | 14 | class echoConstants { 15 | public: 16 | echoConstants(); 17 | 18 | }; 19 | 20 | extern const echoConstants g_echo_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/cthrift/tests/main_svr.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Chao Shu on 16/4/5. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #define private public 21 | #define protected public 22 | #include 23 | #include 24 | #undef private 25 | #undef protected 26 | 27 | using namespace std; 28 | 29 | using namespace apache::thrift; 30 | using namespace apache::thrift::protocol; 31 | using namespace apache::thrift::transport; 32 | using namespace apache::thrift::async; 33 | 34 | int main(int argc, char **argv) { 35 | 36 | testing::InitGoogleTest(&argc, argv); 37 | 38 | log4cplus::PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.conf")); 39 | 40 | return RUN_ALL_TESTS();; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /whale/docs/image/bench_test_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/bench_test_1.png -------------------------------------------------------------------------------- /whale/docs/image/bench_test_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/bench_test_2.png -------------------------------------------------------------------------------- /whale/docs/image/cthrift-ar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/cthrift-ar.jpg -------------------------------------------------------------------------------- /whale/docs/image/cthrift_async.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/cthrift_async.jpg -------------------------------------------------------------------------------- /whale/docs/image/cthrift_client.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/cthrift_client.jpg -------------------------------------------------------------------------------- /whale/docs/image/cthrift_q.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/cthrift_q.png -------------------------------------------------------------------------------- /whale/docs/image/cthrift_server.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/cthrift_server.jpg -------------------------------------------------------------------------------- /whale/docs/image/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/docs/image/register.png -------------------------------------------------------------------------------- /whale/example/conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "ns": { 3 | "origin": "127.0.0.1:2181", 4 | "ismns": 0, 5 | "env":"test" 6 | }, 7 | "client.Appkey": "com.sankuai.inf.newct.client", 8 | "server.Version": "3.0.0", 9 | "server.ListenPort": 16888, 10 | "server.Appkey": "com.sankuai.inf.newct", 11 | "server.register": 1, 12 | "server.WorkThreadNum": 4, 13 | "server.MaxConnNum": 10000, 14 | "server.ServerTimeOut": 100, 15 | "server.ConnGCTime": 10, 16 | "server.ConnThreadNum": 4 17 | } 18 | -------------------------------------------------------------------------------- /whale/example/echo.thrift: -------------------------------------------------------------------------------- 1 | namespace cpp echo 2 | namespace py echo 3 | namespace java echo 4 | 5 | service Echo 6 | { 7 | string echo(1: string arg); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /whale/example/echo/Echo_async_server.skeleton.cpp: -------------------------------------------------------------------------------- 1 | // This autogenerated skeleton file illustrates one way to adapt a synchronous 2 | // interface into an asynchronous interface. You should copy it to another 3 | // filename to avoid overwriting it and rewrite as asynchronous any functions 4 | // that would otherwise introduce unwanted latency. 5 | 6 | #include "Echo.h" 7 | #include 8 | #include 9 | 10 | using namespace ::apache::thrift; 11 | using namespace ::apache::thrift::protocol; 12 | using namespace ::apache::thrift::transport; 13 | using namespace ::apache::thrift::async; 14 | 15 | using boost::shared_ptr; 16 | 17 | using namespace ::echo; 18 | 19 | class EchoAsyncHandler : public EchoCobSvIf { 20 | public: 21 | EchoAsyncHandler() { 22 | syncHandler_ = std::auto_ptr(new EchoHandler); 23 | // Your initialization goes here 24 | } 25 | virtual ~EchoAsyncHandler(); 26 | 27 | void echo(std::tr1::function cob, const std::string& arg) { 28 | std::string _return = ""; 29 | syncHandler_->echo(_return, arg); 30 | return cob(_return); 31 | } 32 | 33 | protected: 34 | std::auto_ptr syncHandler_; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /whale/example/echo/echo_constants.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "echo_constants.h" 8 | 9 | namespace echo { 10 | 11 | const echoConstants g_echo_constants; 12 | 13 | echoConstants::echoConstants() { 14 | } 15 | 16 | } // namespace 17 | 18 | -------------------------------------------------------------------------------- /whale/example/echo/echo_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef echo_CONSTANTS_H 8 | #define echo_CONSTANTS_H 9 | 10 | #include "echo_types.h" 11 | 12 | namespace echo { 13 | 14 | class echoConstants { 15 | public: 16 | echoConstants(); 17 | 18 | }; 19 | 20 | extern const echoConstants g_echo_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/example/echo/echo_types.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #include "echo_types.h" 8 | 9 | namespace echo { 10 | 11 | } // namespace 12 | -------------------------------------------------------------------------------- /whale/example/echo/echo_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef echo_TYPES_H 8 | #define echo_TYPES_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | 17 | namespace echo { 18 | 19 | } // namespace 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/ThriftSpans_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef ThriftSpans_CONSTANTS_H 8 | #define ThriftSpans_CONSTANTS_H 9 | 10 | #include "ThriftSpans_types.h" 11 | 12 | 13 | 14 | class ThriftSpansConstants { 15 | public: 16 | ThriftSpansConstants(); 17 | 18 | }; 19 | 20 | extern const ThriftSpansConstants g_ThriftSpans_constants; 21 | 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/mnsc_data_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef mnsc_data_CONSTANTS_H 8 | #define mnsc_data_CONSTANTS_H 9 | 10 | #include "mnsc_data_types.h" 11 | 12 | namespace meituan_mns { 13 | 14 | class mnsc_dataConstants { 15 | public: 16 | mnsc_dataConstants(); 17 | 18 | std::string PROD; 19 | std::string STAGE; 20 | std::string TEST; 21 | int32_t SUCCESS; 22 | int32_t MNSCache_UPDATE; 23 | int32_t TIMEOUT_ERROR; 24 | int32_t ILLEGAL_ARGUMENT; 25 | int32_t NOT_FOUND; 26 | int32_t NOT_MODIFIED; 27 | }; 28 | 29 | extern const mnsc_dataConstants g_mnsc_data_constants; 30 | 31 | } // namespace 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/mnsc_service_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef mnsc_service_CONSTANTS_H 8 | #define mnsc_service_CONSTANTS_H 9 | 10 | #include "mnsc_service_types.h" 11 | 12 | namespace meituan_mns { 13 | 14 | class mnsc_serviceConstants { 15 | public: 16 | mnsc_serviceConstants(); 17 | 18 | }; 19 | 20 | extern const mnsc_serviceConstants g_mnsc_service_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/mnsc_service_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef mnsc_service_TYPES_H 8 | #define mnsc_service_TYPES_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "mnsc_data_types.h" 16 | 17 | 18 | namespace meituan_mns { 19 | 20 | typedef class ::meituan_mns::MNSResponse MNSResponse; 21 | 22 | typedef class ::meituan_mns::MNSBatchResponse MNSBatchResponse; 23 | 24 | typedef class ::meituan_mns::AppKeyListResponse AppKeyListResponse; 25 | 26 | typedef class ::meituan_mns::MnsRequest MnsRequest; 27 | 28 | typedef ::meituan_mns::SGService SGService; 29 | 30 | } // namespace 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/naming_common_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef naming_common_CONSTANTS_H 8 | #define naming_common_CONSTANTS_H 9 | 10 | #include "naming_common_types.h" 11 | 12 | namespace meituan_mns { 13 | 14 | class naming_commonConstants { 15 | public: 16 | naming_commonConstants(); 17 | 18 | }; 19 | 20 | extern const naming_commonConstants g_naming_common_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/naming_data_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef naming_data_CONSTANTS_H 8 | #define naming_data_CONSTANTS_H 9 | 10 | #include "naming_data_types.h" 11 | 12 | namespace meituan_mns { 13 | 14 | class naming_dataConstants { 15 | public: 16 | naming_dataConstants(); 17 | 18 | }; 19 | 20 | extern const naming_dataConstants g_naming_data_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/naming_service_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef naming_service_CONSTANTS_H 8 | #define naming_service_CONSTANTS_H 9 | 10 | #include "naming_service_types.h" 11 | 12 | namespace meituan_mns { 13 | 14 | class naming_serviceConstants { 15 | public: 16 | naming_serviceConstants(); 17 | 18 | }; 19 | 20 | extern const naming_serviceConstants g_naming_service_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/naming_service_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef naming_service_TYPES_H 8 | #define naming_service_TYPES_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "naming_common_types.h" 16 | 17 | 18 | namespace meituan_mns { 19 | 20 | typedef class ::meituan_mns::SGService SGService; 21 | 22 | typedef class ::meituan_mns::ProtocolRequest ProtocolRequest; 23 | 24 | typedef class ::meituan_mns::ProtocolResponse ProtocolResponse; 25 | 26 | } // namespace 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /whale/thrid/include/octoidl/unified_protocol_constants.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift Compiler (0.8.0) 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | #ifndef unified_protocol_CONSTANTS_H 8 | #define unified_protocol_CONSTANTS_H 9 | 10 | #include "unified_protocol_types.h" 11 | 12 | namespace meituan_mns { 13 | 14 | class unified_protocolConstants { 15 | public: 16 | unified_protocolConstants(); 17 | 18 | }; 19 | 20 | extern const unified_protocolConstants g_unified_protocol_constants; 21 | 22 | } // namespace 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /whale/thrid/lib/libmns_sdk.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/thrid/lib/libmns_sdk.a -------------------------------------------------------------------------------- /whale/thrid/lib/libmns_sdk.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/thrid/lib/libmns_sdk.so -------------------------------------------------------------------------------- /whale/thrid/lib/liboctoidl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/thrid/lib/liboctoidl.a -------------------------------------------------------------------------------- /whale/thrid/lib/liboctoidl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meituan-Dianping/octo-rpc/b7aaefe900368cfc4edf1fd793a2521e9f48aec1/whale/thrid/lib/liboctoidl.so -------------------------------------------------------------------------------- /whale/tool/clear4git.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rm -rf ../cmake_install.cmake ../CMakeCache.txt ../CMakeFiles ../Makefile ../build/ ../install_manifest.txt 4 | rm -rf ../cthrift/cmake_install.cmake ../cthrift/CMakeCache.txt . 5 | ./cthrift/CMakeFiles ../cthrift/Makefile 6 | rm -rf ../cthrift/tests/cmake_install.cmake ../cthrift/tests/CMakeCache.txt ../cthrift/tests/CMakeFiles ../cthrift/tests/Makefile 7 | rm -rf ../example/cmake_install.cmake ../example/CMakeCache.txt ../example/CMakeFiles ../example/Makefile 8 | 9 | find ../ -name .*.sw* -exec rm -rf {} \; 10 | --------------------------------------------------------------------------------