Skip to content

Commit

Permalink
Merge pull request #2 from flycash/2.7.5-bk
Browse files Browse the repository at this point in the history
Fix Some Bug and merger origin/develop
  • Loading branch information
lzp0412 authored May 1, 2020
2 parents 8022392 + 8b720aa commit 3aa0082
Show file tree
Hide file tree
Showing 50 changed files with 666 additions and 347 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Apache License, Version 2.0

## Release note ##

[v1.4.0-rc1 - Mar 12, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.4.0-rc1)
[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)

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Apache License, Version 2.0

## 发布日志 ##

[v1.4.0-rc1 - 2020年3月12日](https://github.com/apache/dubbo-go/releases/tag/v1.4.0-rc1)
[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)

Expand Down
41 changes: 41 additions & 0 deletions common/extension/registry_directory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package extension

import (
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/registry"
)

type registryDirectory func(url *common.URL, registry registry.Registry) (cluster.Directory, error)

var defaultRegistry registryDirectory

// SetDefaultRegistryDirectory ...
func SetDefaultRegistryDirectory(v registryDirectory) {
defaultRegistry = v
}

// GetDefaultRegistryDirectory ...
func GetDefaultRegistryDirectory(config *common.URL, registry registry.Registry) (cluster.Directory, error) {
if defaultRegistry == nil {
panic("registry directory is not existing, make sure you have import the package.")
}
return defaultRegistry(config, registry)
}
2 changes: 1 addition & 1 deletion common/extension/service_instance_selector_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package extension

import (
"github.com/apache/dubbo-go/registry/service/instance"
"github.com/apache/dubbo-go/registry/servicediscovery/instance"
perrors "github.com/pkg/errors"
)

Expand Down
58 changes: 58 additions & 0 deletions common/observer/dispatcher/mock_event_dispatcher.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dispatcher

import (
"github.com/apache/dubbo-go/common/observer"
)

// MockEventDispatcher will do nothing.
// It is only used by tests
// Now the implementation doing nothing,
// But you can modify this if needed
type MockEventDispatcher struct {
}

// AddEventListener do nothing
func (m MockEventDispatcher) AddEventListener(listener observer.EventListener) {
}

// AddEventListeners do nothing
func (m MockEventDispatcher) AddEventListeners(listenersSlice []observer.EventListener) {
}

// RemoveEventListener do nothing
func (m MockEventDispatcher) RemoveEventListener(listener observer.EventListener) {
}

// RemoveEventListeners do nothing
func (m MockEventDispatcher) RemoveEventListeners(listenersSlice []observer.EventListener) {
}

// GetAllEventListeners return empty list
func (m MockEventDispatcher) GetAllEventListeners() []observer.EventListener {
return make([]observer.EventListener, 0)
}

// RemoveAllEventListeners do nothing
func (m MockEventDispatcher) RemoveAllEventListeners() {
}

// Dispatch do nothing
func (m MockEventDispatcher) Dispatch(event observer.Event) {
}
7 changes: 3 additions & 4 deletions common/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
typError = reflect.Zero(reflect.TypeOf((*error)(nil)).Elem()).Type()
)

// NewProxy ...
// NewProxy create service proxy.
func NewProxy(invoke protocol.Invoker, callBack interface{}, attachments map[string]string) *Proxy {
return &Proxy{
invoke: invoke,
Expand All @@ -59,7 +59,6 @@ func NewProxy(invoke protocol.Invoker, callBack interface{}, attachments map[str
// type XxxProvider struct {
// Yyy func(ctx context.Context, args []interface{}, rsp *Zzz) error
// }

func (p *Proxy) Implement(v common.RPCService) {

// check parameters, incoming interface must be a elem's pointer.
Expand Down Expand Up @@ -202,12 +201,12 @@ func (p *Proxy) Implement(v common.RPCService) {

}

// Get ...
// Get get rpc service instance.
func (p *Proxy) Get() common.RPCService {
return p.rpc
}

// GetCallback ...
// GetCallback get callback.
func (p *Proxy) GetCallback() interface{} {
return p.callBack
}
2 changes: 1 addition & 1 deletion common/proxy/proxy_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/apache/dubbo-go/protocol"
)

// ProxyFactory ...
// ProxyFactory interface.
type ProxyFactory interface {
GetProxy(invoker protocol.Invoker, url *common.URL) *Proxy
GetAsyncProxy(invoker protocol.Invoker, callBack interface{}, url *common.URL) *Proxy
Expand Down
23 changes: 11 additions & 12 deletions common/rpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type AsyncCallback func(response CallbackResponse)
// return map[string][string]{}
// }
const (
// METHOD_MAPPER ...
METHOD_MAPPER = "MethodMapper"
)

Expand All @@ -68,7 +67,7 @@ var (
// because Typeof takes an empty interface value. This is annoying.
typeOfError = reflect.TypeOf((*error)(nil)).Elem()

// ServiceMap ...
// ServiceMap store description of service.
// todo: lowerecas?
ServiceMap = &serviceMap{
serviceMap: make(map[string]map[string]*Service),
Expand All @@ -80,35 +79,35 @@ var (
// info of method
//////////////////////////

// MethodType ...
// MethodType is description of service method.
type MethodType struct {
method reflect.Method
ctxType reflect.Type // request context
argsType []reflect.Type // args except ctx, include replyType if existing
replyType reflect.Type // return value, otherwise it is nil
}

// Method ...
// Method get @m.method.
func (m *MethodType) Method() reflect.Method {
return m.method
}

// CtxType ...
// CtxType get @m.ctxType.
func (m *MethodType) CtxType() reflect.Type {
return m.ctxType
}

// ArgsType ...
// ArgsType get @m.argsType.
func (m *MethodType) ArgsType() []reflect.Type {
return m.argsType
}

// ReplyType ...
// ReplyType get @m.replyType.
func (m *MethodType) ReplyType() reflect.Type {
return m.replyType
}

// SuiteContext ...
// SuiteContext tranfer @ctx to reflect.Value type or get it from @m.ctxType.
func (m *MethodType) SuiteContext(ctx context.Context) reflect.Value {
if contextv := reflect.ValueOf(ctx); contextv.IsValid() {
return contextv
Expand All @@ -120,15 +119,15 @@ func (m *MethodType) SuiteContext(ctx context.Context) reflect.Value {
// info of service interface
//////////////////////////

// Service ...
// Service is description of service
type Service struct {
name string
rcvr reflect.Value
rcvrType reflect.Type
methods map[string]*MethodType
}

// Method ...
// Method get @s.methods.
func (s *Service) Method() map[string]*MethodType {
return s.methods
}
Expand All @@ -138,12 +137,12 @@ func (s *Service) Name() string {
return s.name
}

// RcvrType ...
// RcvrType get @s.rcvrType.
func (s *Service) RcvrType() reflect.Type {
return s.rcvrType
}

// Rcvr ...
// Rcvr get @s.rcvr.
func (s *Service) Rcvr() reflect.Value {
return s.rcvr
}
Expand Down
Loading

0 comments on commit 3aa0082

Please sign in to comment.