You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by dl...@apache.org on 2019/07/23 17:08:30 UTC
[dubbo-erlang] 03/09: redesign the protocol callback
This is an automated email from the ASF dual-hosted git repository.
dlive pushed a commit to branch 0.4.0
in repository https://gitbox.apache.org/repos/asf/dubbo-erlang.git
commit fc0072d302c39140aef5bfd6ec10b8b8fbc1b93f
Author: DLive <xs...@163.com>
AuthorDate: Mon Jun 17 23:22:58 2019 +0800
redesign the protocol callback
---
src/dubbo_common_fun.erl | 2 +-
src/dubbo_directory.erl | 7 +------
src/dubbo_protocol.erl | 14 +++++++-------
src/dubbo_protocol_dubbo.erl | 18 ++++++++++++++----
4 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/dubbo_common_fun.erl b/src/dubbo_common_fun.erl
index e74f57f..6717fac 100644
--- a/src/dubbo_common_fun.erl
+++ b/src/dubbo_common_fun.erl
@@ -32,7 +32,7 @@ local_ip_v4_str() ->
list_to_binary(io_lib:format("~p.~p.~p.~p", [V1, V2, V3, V4])).
--spec(parse_url(Url :: binary()|list()) -> {ok, map()}).
+-spec(parse_url(Url :: binary()|list()) -> {ok, #dubbo_url{}}).
parse_url(Url) when is_binary(Url) ->
parse_url(binary_to_list(Url));
parse_url(Url) ->
diff --git a/src/dubbo_directory.erl b/src/dubbo_directory.erl
index 08e959c..3674a91 100644
--- a/src/dubbo_directory.erl
+++ b/src/dubbo_directory.erl
@@ -83,12 +83,7 @@ subscribe(RegistryName,SubcribeUrl)->
notify(Interface,UrlList)->
%% @todo if UrlList size is 1, and protocol is empty ,need destroyAllInvokers
- case dubbo_extension:run_fold(protocol,refer,[UrlList],{error,no_protocol}) of
- {ok,Invokers} ->
- ok;
- {error,no_protocol}->
- error
- end,
+ refresh_invoker(UrlList),
%% dubbo_consumer_pool:start_consumer(Interface, UrlList),
ok.
diff --git a/src/dubbo_protocol.erl b/src/dubbo_protocol.erl
index 8808fc8..7ecfcd8 100644
--- a/src/dubbo_protocol.erl
+++ b/src/dubbo_protocol.erl
@@ -16,11 +16,11 @@
%%------------------------------------------------------------------------------
-module(dubbo_protocol).
--callback refer(Url)->ok.
+-callback refer(Url,Acc)->ok.
-%% API
--export([refer/2]).
-
-
-refer(InterfaceClassInfo,Url)->
- dubbo_hooker(protocol_wapper,refer,[InterfaceClassInfo,Url]).
\ No newline at end of file
+%%%% API
+%%-export([refer/2]).
+%%
+%%
+%%refer(InterfaceClassInfo,Url)->
+%% dubbo_hooker(protocol_wapper,refer,[InterfaceClassInfo,Url]).
\ No newline at end of file
diff --git a/src/dubbo_protocol_dubbo.erl b/src/dubbo_protocol_dubbo.erl
index c2fb6dd..06c36e6 100644
--- a/src/dubbo_protocol_dubbo.erl
+++ b/src/dubbo_protocol_dubbo.erl
@@ -15,11 +15,21 @@
%% limitations under the License.
%%------------------------------------------------------------------------------
-module(dubbo_protocol_dubbo).
--author("dlive").
+
+-include("dubboerl.hrl").
%% API
--export([refer/1]).
+-export([refer/2]).
+
+refer(Url,Acc)->
+ {ok,UrlInfo} = dubbo_common_fun:parse_url(Url),
+ case UrlInfo#dubbo_url.scheme of
+ <<"dubbo">> ->
+ {ok,todo};
+ _ ->
+ {skip,Acc}
+ end.
-refer(Url)->
+do_refer(UrlInfo)->
- {ok,todo}.
\ No newline at end of file
+ ok.
\ No newline at end of file