Skip to content
Snippets Groups Projects
Commit aec9817a authored by lzp0412's avatar lzp0412 Committed by GitHub
Browse files

Merge pull request #18 from apache/develop

Develop
parents bf364f7e 7ad7286d
No related branches found
No related tags found
No related merge requests found
Showing
with 65 additions and 15 deletions
Apache Dubbo Go
Apache Dubbo-go
Copyright 2018-2020 The Apache Software Foundation
This product includes software developed at
......
......@@ -16,6 +16,8 @@ Apache License, Version 2.0
## Release note ##
[v1.5.0 - July 24, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.5.0)
[v1.4.0 - Mar 17, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.4.0)
[v1.3.0 - Mar 1, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.3.0)
......@@ -49,6 +51,7 @@ Finished List:
- Codec
* JsonRPC V2
* Hessian V2
* [json for grpc](https://github.com/apache/dubbo-go/pull/582)
- Protocol
* Dubbo
......@@ -110,6 +113,17 @@ Finished List:
* [For dubbo](https://github.com/apache/dubbo-go/pull/344)
* [For grpc](https://github.com/apache/dubbo-go/pull/397)
- Metadata Center
* [Nacos](https://github.com/apache/dubbo-go/pull/522)
* [Zookeeper](https://github.com/apache/dubbo-go/pull/633)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/metadata/report/etcd/report.go)
* [Consul](https://github.com/apache/dubbo-go/pull/633)
- Service discovery
* [Nacos](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/nacos/service_discovery.go)
* [Zookeeper](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/zookeeper/service_discovery.go)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/etcdv3/service_discovery.go)
- Others:
* start check
* connecting certain provider
......@@ -118,11 +132,6 @@ Finished List:
* multi-versions
* service group
Working List:
- Metadata Center (dubbo v2.7.x)
- Service Discovery (dubbo v2.7.x)
You can know more about dubbo-go by its [roadmap](https://github.com/apache/dubbo-go/wiki/Roadmap).
![feature](./doc/pic/arch/dubbo-go-arch.png)
......
......@@ -15,6 +15,8 @@ Apache License, Version 2.0
## 发布日志 ##
[v1.5.0 - 2020年7月24日](https://github.com/apache/dubbo-go/releases/tag/v1.5.0)
[v1.4.0 - 2020年3月17日](https://github.com/apache/dubbo-go/releases/tag/v1.4.0)
[v1.3.0 - 2020年3月1日](https://github.com/apache/dubbo-go/releases/tag/v1.3.0)
......@@ -48,6 +50,7 @@ Apache License, Version 2.0
- 序列化协议
* JsonRPC V2
* Hessian V2
* [json for grpc](https://github.com/apache/dubbo-go/pull/582)
- 协议
* Dubbo
......@@ -108,6 +111,16 @@ Apache License, Version 2.0
* [For dubbo](https://github.com/apache/dubbo-go/pull/344)
* [For grpc](https://github.com/apache/dubbo-go/pull/397)
- 元数据中心
* [Nacos](https://github.com/apache/dubbo-go/pull/522)
* [Zookeeper](https://github.com/apache/dubbo-go/pull/633)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/metadata/report/etcd/report.go)
* [Consul](https://github.com/apache/dubbo-go/pull/633)
- 服务发现
* [Nacos](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/nacos/service_discovery.go)
* [Zookeeper](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/zookeeper/service_discovery.go)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/etcdv3/service_discovery.go)
- 其他功能支持:
* 启动时检查
......@@ -117,11 +130,6 @@ Apache License, Version 2.0
* 多服务版本
* 服务分组
开发中列表:
- 元数据中心 (dubbo v2.7.x)
- 服务发现 (dubbo v2.7.x)
你可以通过访问 [roadmap](https://github.com/apache/dubbo-go/wiki/Roadmap) 知道更多关于 dubbo-go 的信息。
![feature](./doc/pic/arch/dubbo-go-arch.png)
......@@ -172,7 +180,7 @@ go test ./... -coverprofile=coverage.txt -covermode=atomic
## [User List](https://github.com/apache/dubbo-go/issues/2)
若你正在使用 [apache/dubbo-go](github.com/apache/dubbo-go) 且认为其有用或者对其做改进,请列贵司信息于 [用户列表](https://github.com/apache/dubbo-go/issues/2),以便我们知晓
若你正在使用 [apache/dubbo-go](github.com/apache/dubbo-go) 且认为其有用或者对其做改进,请列贵司信息于 [用户列表](https://github.com/apache/dubbo-go/issues/2),以便我们知晓。
<div>
<table>
......
......@@ -38,6 +38,7 @@ func NewAvailableCluster() cluster.Cluster {
return &availableCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluser *availableCluster) Join(directory cluster.Directory) protocol.Invoker {
return NewAvailableClusterInvoker(directory)
}
......@@ -39,6 +39,7 @@ func NewBroadcastCluster() cluster.Cluster {
return &broadcastCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluster *broadcastCluster) Join(directory cluster.Directory) protocol.Invoker {
return newBroadcastClusterInvoker(directory)
}
......@@ -36,6 +36,7 @@ func newBroadcastClusterInvoker(directory cluster.Directory) protocol.Invoker {
}
}
// nolint
func (invoker *broadcastClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
invokers := invoker.directory.List(invocation)
err := invoker.checkInvokers(invokers, invocation)
......
......@@ -39,6 +39,7 @@ func NewFailbackCluster() cluster.Cluster {
return &failbackCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluster *failbackCluster) Join(directory cluster.Directory) protocol.Invoker {
return newFailbackClusterInvoker(directory)
}
......@@ -126,6 +126,7 @@ func (invoker *failbackClusterInvoker) checkRetry(retryTask *retryTimerTask, err
}
}
// nolint
func (invoker *failbackClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
invokers := invoker.directory.List(invocation)
if err := invoker.checkInvokers(invokers, invocation); err != nil {
......
......@@ -39,6 +39,7 @@ func NewFailFastCluster() cluster.Cluster {
return &failfastCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluster *failfastCluster) Join(directory cluster.Directory) protocol.Invoker {
return newFailFastClusterInvoker(directory)
}
......@@ -35,6 +35,7 @@ func newFailFastClusterInvoker(directory cluster.Directory) protocol.Invoker {
}
}
// nolint
func (invoker *failfastClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
invokers := invoker.directory.List(invocation)
err := invoker.checkInvokers(invokers, invocation)
......
......@@ -40,6 +40,7 @@ func NewFailoverCluster() cluster.Cluster {
return &failoverCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluster *failoverCluster) Join(directory cluster.Directory) protocol.Invoker {
return newFailoverClusterInvoker(directory)
}
......@@ -19,6 +19,7 @@ package cluster_impl
import (
"context"
"fmt"
"strconv"
)
......@@ -44,6 +45,7 @@ func newFailoverClusterInvoker(directory cluster.Directory) protocol.Invoker {
}
}
// nolint
func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
var (
result protocol.Result
......@@ -91,8 +93,10 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr
invokerSvc := invoker.GetUrl().Service()
invokerUrl := invoker.directory.GetUrl()
return &protocol.RPCResult{
Err: perrors.Errorf("Failed to invoke the method %v in the service %v. Tried %v times of the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. Last error is %v.",
methodName, invokerSvc, retries, providers, len(providers), len(invokers), invokerUrl, ip, constant.Version, result.Error().Error(),
Err: perrors.Wrap(result.Error(), fmt.Sprintf("Failed to invoke the method %v in the service %v. "+
"Tried %v times of the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. "+
"Last error is %+v.", methodName, invokerSvc, retries, providers, len(providers), len(invokers),
invokerUrl, ip, constant.Version, result.Error().Error()),
)}
}
......
......@@ -43,6 +43,7 @@ import (
// mock invoker
// ///////////////////////////
// nolint
type MockInvoker struct {
url common.URL
available bool
......@@ -51,6 +52,7 @@ type MockInvoker struct {
successCount int
}
// nolint
func NewMockInvoker(url common.URL, successCount int) *MockInvoker {
return &MockInvoker{
url: url,
......@@ -60,23 +62,28 @@ func NewMockInvoker(url common.URL, successCount int) *MockInvoker {
}
}
// nolint
func (bi *MockInvoker) GetUrl() common.URL {
return bi.url
}
// nolint
func (bi *MockInvoker) IsAvailable() bool {
return bi.available
}
// nolint
func (bi *MockInvoker) IsDestroyed() bool {
return bi.destroyed
}
// nolint
type rest struct {
tried int
success bool
}
// nolint
func (bi *MockInvoker) Invoke(c context.Context, invocation protocol.Invocation) protocol.Result {
count++
var (
......@@ -93,14 +100,17 @@ func (bi *MockInvoker) Invoke(c context.Context, invocation protocol.Invocation)
return result
}
// nolint
func (bi *MockInvoker) Destroy() {
logger.Infof("Destroy invoker: %v", bi.GetUrl().String())
bi.destroyed = true
bi.available = false
}
// nolint
var count int
// nolint
func normalInvoke(successCount int, urlParam url.Values, invocations ...*invocation.RPCInvocation) protocol.Result {
extension.SetLoadbalance("random", loadbalance.NewRandomLoadBalance)
failoverCluster := NewFailoverCluster()
......@@ -119,6 +129,7 @@ func normalInvoke(successCount int, urlParam url.Values, invocations ...*invocat
return clusterInvoker.Invoke(context.Background(), &invocation.RPCInvocation{})
}
// nolint
func TestFailoverInvokeSuccess(t *testing.T) {
urlParams := url.Values{}
result := normalInvoke(3, urlParams)
......@@ -126,6 +137,7 @@ func TestFailoverInvokeSuccess(t *testing.T) {
count = 0
}
// nolint
func TestFailoverInvokeFail(t *testing.T) {
urlParams := url.Values{}
result := normalInvoke(4, urlParams)
......@@ -133,6 +145,7 @@ func TestFailoverInvokeFail(t *testing.T) {
count = 0
}
// nolint
func TestFailoverInvoke1(t *testing.T) {
urlParams := url.Values{}
urlParams.Set(constant.RETRIES_KEY, "3")
......@@ -141,6 +154,7 @@ func TestFailoverInvoke1(t *testing.T) {
count = 0
}
// nolint
func TestFailoverInvoke2(t *testing.T) {
urlParams := url.Values{}
urlParams.Set(constant.RETRIES_KEY, "2")
......@@ -152,6 +166,7 @@ func TestFailoverInvoke2(t *testing.T) {
count = 0
}
// nolint
func TestFailoverDestroy(t *testing.T) {
extension.SetLoadbalance("random", loadbalance.NewRandomLoadBalance)
failoverCluster := NewFailoverCluster()
......
......@@ -39,6 +39,7 @@ func NewFailsafeCluster() cluster.Cluster {
return &failsafeCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluster *failsafeCluster) Join(directory cluster.Directory) protocol.Invoker {
return newFailsafeClusterInvoker(directory)
}
......@@ -45,6 +45,7 @@ func newFailsafeClusterInvoker(directory cluster.Directory) protocol.Invoker {
}
}
// nolint
func (invoker *failsafeClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
invokers := invoker.directory.List(invocation)
......
......@@ -39,6 +39,7 @@ func NewForkingCluster() cluster.Cluster {
return &forkingCluster{}
}
// Join returns a baseClusterInvoker instance
func (cluster *forkingCluster) Join(directory cluster.Directory) protocol.Invoker {
return newForkingClusterInvoker(directory)
}
......@@ -44,7 +44,7 @@ func newForkingClusterInvoker(directory cluster.Directory) protocol.Invoker {
}
}
// Invoke ...
// nolint
func (invoker *forkingClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
if err := invoker.checkWhetherDestroyed(); err != nil {
return &protocol.RPCResult{Err: err}
......
......@@ -33,6 +33,7 @@ func NewMockCluster() cluster.Cluster {
return &mockCluster{}
}
// nolint
func (cluster *mockCluster) Join(directory cluster.Directory) protocol.Invoker {
return protocol.NewBaseInvoker(directory.GetUrl())
}
......@@ -34,6 +34,7 @@ func NewRegistryAwareCluster() cluster.Cluster {
return &registryAwareCluster{}
}
// nolint
func (cluster *registryAwareCluster) Join(directory cluster.Directory) protocol.Invoker {
return newRegistryAwareClusterInvoker(directory)
}
......@@ -36,6 +36,7 @@ func newRegistryAwareClusterInvoker(directory cluster.Directory) protocol.Invoke
}
}
// nolint
func (invoker *registryAwareClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
invokers := invoker.directory.List(invocation)
//First, pick the invoker (XXXClusterInvoker) that comes from the local registry, distinguish by a 'default' key.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment