del unused code
diff --git a/src/dubbo_provider_consumer_reg_table.erl b/src/dubbo_provider_consumer_reg_table.erl
index e307da3..2b9bd6e 100644
--- a/src/dubbo_provider_consumer_reg_table.erl
+++ b/src/dubbo_provider_consumer_reg_table.erl
@@ -221,43 +221,6 @@
%%%===================================================================
%%% Internal functions
%%%===================================================================
-%%add_consumer([], RegisterList) ->
-%% RegisterList;
-%%add_consumer([ProviderNodeInfo | ProviderList], RegisterList) ->
-%% case dubbo_node_config_util:parse_provider_info(ProviderNodeInfo) of
-%% {ok, ProviderConfig} ->
-%% HostFlag = get_host_flag(ProviderConfig),
-%% case ets:lookup(?PROVIDER_NODE_LIST_TABLE, HostFlag) of
-%% [] ->
-%% ConnectionList = start_provider_process(HostFlag, 30, ProviderConfig),
-%% ok = update_connection_info(ProviderConfig#provider_config.interface, HostFlag, ConnectionList, true),
-%% ok;
-%% List ->
-%% List2 = lists:map(fun(#provider_node_list{connection_info = ConnectionItem}) ->
-%% ConnectionItem
-%% end, List),
-%% ok = update_connection_info(ProviderConfig#provider_config.interface, HostFlag, List2, false),
-%% ok
-%% end,
-%% add_consumer(ProviderList, [HostFlag] ++ RegisterList);
-%% {error, R1} ->
-%% logger:error("parse provider info error reason ~p", [R1]),
-%% add_consumer(ProviderList, RegisterList)
-%% end.
-%%
-%%start_provider_process(HostFlag, Weight, ProviderConfig) ->
-%% ExecutesList = lists:seq(1, ProviderConfig#provider_config.executes),
-%% ConnectionList = lists:map(fun(Item) ->
-%% ConnectionFlag = <<HostFlag/binary, (integer_to_binary(Item))/binary>>,
-%% ConnectionFlagTerm = binary_to_atom(ConnectionFlag, utf8),
-%% AChild = {ConnectionFlagTerm, {dubbo_netty_client, start_link, [ConnectionFlagTerm, HostFlag, ProviderConfig, Item]}, permanent, 2000, worker, [dubbo_netty_client]},
-%% {ok, Pid} = dubbo_transport_pool_sup:add_children(AChild),
-%% logger:info("start provider ~p pid info ~p~n", [HostFlag, Pid]),
-%% #connection_info{connection_id = ConnectionFlagTerm, pid = Pid, weight = Weight, host_flag = HostFlag}
-%% end, ExecutesList),
-%% ConnectionList.
-
-
update_node_conections(Interface, Connections) ->
lists:map(
fun(Item) ->
diff --git a/src/dubbo_type_decoding.erl b/src/dubbo_type_decoding.erl
deleted file mode 100644
index a861855..0000000
--- a/src/dubbo_type_decoding.erl
+++ /dev/null
@@ -1,212 +0,0 @@
-% ---------------------------------------------------------------------------
-% Copyright (C) 2008 0x6e6562
-%
-% Licensed 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.
-% ---------------------------------------------------------------------------
-
--module(dubbo_type_decoding).
--include("hessian.hrl").
-
-%% The encoding state contains all of the statically known tuple types.
-%% When a tuple is to be decoded at run-time, a lookup is performed against
-%% the hash value that the sender passes in.
-%% This must resolve to some type definition,
-%% otherwise no instance of the decoded type can be created.
--record(decoding_state, {type_pool = dict:new(), reference_pool = dict:new(), obj_define_no = 0}).
-
--export([init/0, init/1]).
--export([lookup_reference/2]).
--export([enlist/1, enlist/2]).
--export([hash_lookup/2, hash_store/2, hash_store/1, store_typepool/1]).
--export([visit/2]).
--export([resolve_native_type/2, resolve_native_type/1]).
--export([camel_case_to_erlang/1]).
--export([build_foreign_view/3]).
--export([project_native_view/3]).
-
--define(TYPEPOOL_TABLE, type_pool).
--define(REFERENCEPOOL_TABLE, reference_pool).
-
-camel_case_to_erlang(String) when is_binary(String) ->
- AsList = binary_to_list(String),
- AsErlang = lists:foldl(fun decamelize/2, [], AsList),
- list_to_atom(AsErlang).
-
-decamelize(Element, Acc) when Element >= $A, Element =< $Z ->
- lists:append(Acc, [$_, (Element + 16#20)]);
-decamelize(Element, Acc) -> lists:append(Acc, [Element]).
-
-%% Facility to register a particular type to the pool of known types.
-%% Adds the type to the pool of known types if it doesn't already exist.
-enlist(TypeDef) -> enlist(TypeDef, init()).
-enlist(TypeDef = #type_def{foreign_type = Key},
- State = #decoding_state{type_pool = OldPool}) ->
- ets:insert(?TYPEPOOL_TABLE, {Key, TypeDef}),
- State.
-
-store_typepool(TypeDef = #type_def{foreign_type = Key}) ->
- ets:insert(?TYPEPOOL_TABLE, {Key, TypeDef}),
- TypeDef.
-
-
-
-build_foreign_view(ForeignType, FieldNames, State) ->
- #type_def{native_type = Native} = resolve_native_type(ForeignType, State),
- ForeignView = [camel_case_to_erlang(Fieldname) || Fieldname <- FieldNames],
- DefineNo = State#decoding_state.obj_define_no,
- {#type_def{
- defineNo = State#decoding_state.obj_define_no,
- native_type = Native,
- foreign_type = ForeignType,
- fieldnames = ForeignView}, State#decoding_state{obj_define_no = DefineNo}}.
-
-% Projects the native view over tuples that in foreign order
-project_native_view(ForeignView, ForeignData,
- #type_def{native_type = NativeType, fieldnames = NativeView}) ->
- AsDict = dict:from_list(lists:zip(ForeignView, ForeignData)),
- NativeData = [dict:fetch(Key, AsDict) || Key <- NativeView],
- list_to_tuple([NativeType] ++ NativeData).
-
-resolve_native_type(ForeignType, #decoding_state{type_pool = Pool}) ->
- case ets:lookup(?TYPEPOOL_TABLE, ForeignType) of
- [] ->
- throw({cannot_resolve_type, ForeignType});
- [{ForeignType, TypeDef}] ->
- TypeDef
- end.
-resolve_native_type(ForeignType) ->
- case ets:lookup(?TYPEPOOL_TABLE, ForeignType) of
- [] ->
- undefined;
- [{ForeignType, TypeDef}] ->
- TypeDef
- end.
-%% case dict:fetch(ForeignType,Pool) of
-%% error ->
-%% throw({cannot_resolve_type,ForeignType});
-%% TypeDef ->
-%% TypeDef
-%% end.
-
-%% Creates a reference for a type def that is unique within the
-%% current invocation context
-visit(TypeDef, State = #decoding_state{reference_pool = OldPool}) ->
- Size = ets:info(?REFERENCEPOOL_TABLE, size),
- ets:insert(?REFERENCEPOOL_TABLE, {Size, TypeDef#type_def{defineNo = Size}}),
- State.
-%% Size = dict:size(OldPool),
-%% NewPool = dict:store(Size, TypeDef, OldPool),
-%% State#decoding_state{reference_pool = NewPool}.
-
-%% Resolves a type def based on a reference that must be have set
-%% with the current invocation context
-lookup_reference(Ref, #decoding_state{reference_pool = Pool}) ->
- case ets:lookup(?REFERENCEPOOL_TABLE, Ref) of
- [] ->
- throw("Lookup of unknown reference");
- [{Ref, TypeDef}] ->
- TypeDef
- end.
-%?LOG(Pool),
-%?LOG(Ref),
-%% case dict:fetch(Ref,Pool) of
-%% error ->
-%%%% ?ERROR(Ref, Pool),
-%% throw("Lookup of unknown reference");
-%% TypeDef ->
-%% TypeDef
-%% end.
-
-%% Does what it says on the tin.
-hash_lookup(Hash, _State) ->
-%% init(false),
- case ets:lookup(?REFERENCEPOOL_TABLE, Hash) of
- [] ->
- {not_found, Hash};
- [{Hash, TypeDef}] ->
- TypeDef
- end.
-
-%% Does what it says on the tin.
-hash_store(#type_def{defineNo = Hash} = TypeDef, State) ->
-%% init(false),
- case Hash of
- -1 ->
- Size = ets:info(?REFERENCEPOOL_TABLE, size),
- ets:insert(?REFERENCEPOOL_TABLE, {Size, TypeDef#type_def{defineNo = Size}});
- _ ->
- ets:insert(?REFERENCEPOOL_TABLE, {Hash, TypeDef})
- end,
- State.
-hash_store(#type_def{defineNo = Hash} = TypeDef) ->
-%% init(false),
- NewTypeDef = case Hash of
- -1 ->
- Size = ets:info(?REFERENCEPOOL_TABLE, size),
- TypeDef2 = TypeDef#type_def{defineNo = Size},
- TypeDef2;
- _ ->
- TypeDef
- end,
- ets:insert(?REFERENCEPOOL_TABLE, {NewTypeDef#type_def.defineNo, NewTypeDef}),
- NewTypeDef.
-
-init() -> init(false).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Non-API functions
-
-
-%% This creates a new ETS table for the types that have been received by
-%% this instance of Hessian
-init(Delete) when is_boolean(Delete) ->
-%% case ets:info(hashes) of
-%% undefined ->
-%% io:format("init decoding table pid ~p~n",[self()]),
-%% ets:new(hashes,[public,named_table]); %% public
-%% EtsInfo ->
-%%%% io:format("type decoding etsinfo ~p~n",[EtsInfo]),
-%% if
-%% Delete == true ->
-%% ets:delete(hashes),
-%% ets:new(hashes,[public,named_table]);
-%% true ->
-%% ok
-%% end
-%% end,
- case ets:info(?TYPEPOOL_TABLE) of
- undefined ->
- ets:new(?TYPEPOOL_TABLE, [public, named_table]); %% public
- _ ->
-%% io:format("type decoding etsinfo ~p~n",[EtsInfo]),
- if
- Delete == true ->
- ets:delete(?TYPEPOOL_TABLE),
- ets:new(?TYPEPOOL_TABLE, [public, named_table]);
- true ->
- ok
- end
- end,
- case ets:info(?REFERENCEPOOL_TABLE) of
- undefined ->
- ets:new(?REFERENCEPOOL_TABLE, [public, named_table]); %% public
- _ ->
- if
- Delete == true ->
- ets:delete(?REFERENCEPOOL_TABLE),
- ets:new(?REFERENCEPOOL_TABLE, [public, named_table]);
- true ->
- ok
- end
- end,
- #decoding_state{}.
\ No newline at end of file
diff --git a/src/dubbo_type_transfer.erl b/src/dubbo_type_transfer.erl
index 3f1af96..d92221e 100644
--- a/src/dubbo_type_transfer.erl
+++ b/src/dubbo_type_transfer.erl
@@ -68,7 +68,6 @@
pre_process_typedef(NativeType, ForeignType, FieldsNames) ->
Type = #type_def{native_type = NativeType, foreign_type = ForeignType, fieldnames = FieldsNames},
-%% Type2=type_decoding:hash_store(Type),
dubbo_type_register:regiest_foreign_native(Type),
logger:debug("pre_process_typedef ~p,~p", [NativeType, ForeignType]),
ok.