diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-11-11 09:39:36 +0000 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-11-11 09:39:36 +0000 |
commit | 1ebacc3dcf63320c4ebfc55d956134b6ab67b9aa (patch) | |
tree | 26e81bb9dd9c4f007b3b6b13020b52750000014a | |
parent | df0b88c11ab4e06d35b93b5cce479ef2a08b51d2 (diff) | |
parent | 3028f637ecd26d5f9883f584256412ace14e27c0 (diff) | |
download | rabbitmq-server-1ebacc3dcf63320c4ebfc55d956134b6ab67b9aa.tar.gz |
merge bug23475 into default (eliminate dialyzer errors)
-rw-r--r-- | codegen.py | 10 | ||||
-rw-r--r-- | src/gen_server2.erl | 27 | ||||
-rw-r--r-- | src/rabbit_access_control.erl | 4 | ||||
-rw-r--r-- | src/rabbit_amqqueue.erl | 4 | ||||
-rw-r--r-- | src/rabbit_binary_generator.erl | 7 | ||||
-rw-r--r-- | src/rabbit_binding.erl | 6 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 2 | ||||
-rw-r--r-- | src/rabbit_framing.erl | 64 | ||||
-rw-r--r-- | src/rabbit_invariable_queue.erl | 2 | ||||
-rw-r--r-- | src/rabbit_misc.erl | 41 | ||||
-rw-r--r-- | src/rabbit_msg_store.erl | 6 | ||||
-rw-r--r-- | src/rabbit_queue_index.erl | 2 | ||||
-rw-r--r-- | src/rabbit_reader.erl | 8 | ||||
-rw-r--r-- | src/rabbit_ssl.erl | 4 | ||||
-rw-r--r-- | src/rabbit_types.erl | 2 | ||||
-rw-r--r-- | src/rabbit_variable_queue.erl | 2 | ||||
-rw-r--r-- | src/rabbit_writer.erl | 5 | ||||
-rw-r--r-- | src/supervisor2.erl | 3 |
18 files changed, 133 insertions, 66 deletions
@@ -345,9 +345,11 @@ def genErl(spec): print "%% Various types" print "-ifdef(use_specs)." - print """-export_type([amqp_table/0, amqp_property_type/0, amqp_method_record/0, - amqp_method_name/0, amqp_method/0, amqp_class_id/0, - amqp_value/0, amqp_array/0, amqp_exception/0, amqp_property_record/0]). + print """-export_type([amqp_field_type/0, amqp_property_type/0, + amqp_table/0, amqp_array/0, amqp_value/0, + amqp_method_name/0, amqp_method/0, amqp_method_record/0, + amqp_method_field_name/0, amqp_property_record/0, + amqp_exception/0, amqp_exception_code/0, amqp_class_id/0]). -type(amqp_field_type() :: 'longstr' | 'signedint' | 'decimal' | 'timestamp' | @@ -415,7 +417,7 @@ def genErl(spec): (amqp_method_name(), binary()) -> amqp_method_record() | rabbit_types:connection_exit()). -spec(decode_properties/2 :: (non_neg_integer(), binary()) -> amqp_property_record()). -spec(encode_method_fields/1 :: (amqp_method_record()) -> binary()). --spec(encode_properties/1 :: (amqp_method_record()) -> binary()). +-spec(encode_properties/1 :: (amqp_property_record()) -> binary()). -spec(lookup_amqp_exception/1 :: (amqp_exception()) -> {boolean(), amqp_exception_code(), binary()}). -spec(amqp_exception/1 :: (amqp_exception_code()) -> amqp_exception()). -endif. % use_specs diff --git a/src/gen_server2.erl b/src/gen_server2.erl index 230d1f2a..6e02b23e 100644 --- a/src/gen_server2.erl +++ b/src/gen_server2.erl @@ -177,7 +177,7 @@ format_status/2]). %% Internal exports --export([init_it/6, print_event/3]). +-export([init_it/6]). -import(error_logger, [format/2]). @@ -192,10 +192,13 @@ -ifdef(use_specs). --spec(handle_common_termination/3 :: - (any(), atom(), #gs2_state{}) -> no_return()). +-type(gs2_state() :: #gs2_state{}). --spec(hibernate/1 :: (#gs2_state{}) -> no_return()). +-spec(handle_common_termination/3 :: + (any(), atom(), gs2_state()) -> no_return()). +-spec(hibernate/1 :: (gs2_state()) -> no_return()). +-spec(pre_hibernate/1 :: (gs2_state()) -> no_return()). +-spec(system_terminate/4 :: (_, _, _, gs2_state()) -> no_return()). -endif. @@ -612,7 +615,7 @@ process_msg(Msg, _Msg when Debug =:= [] -> handle_msg(Msg, GS2State); _Msg -> - Debug1 = sys:handle_debug(Debug, {?MODULE, print_event}, + Debug1 = sys:handle_debug(Debug, fun print_event/3, Name, {in, Msg}), handle_msg(Msg, GS2State #gs2_state { debug = Debug1 }) end. @@ -838,13 +841,13 @@ handle_msg({'$gen_call', From, Msg}, GS2State = #gs2_state { mod = Mod, time = Time1, debug = Debug1}); {noreply, NState} -> - Debug1 = common_debug(Debug, {?MODULE, print_event}, Name, + Debug1 = common_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(GS2State #gs2_state {state = NState, time = infinity, debug = Debug1}); {noreply, NState, Time1} -> - Debug1 = common_debug(Debug, {?MODULE, print_event}, Name, + Debug1 = common_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(GS2State #gs2_state {state = NState, time = Time1, @@ -866,13 +869,13 @@ handle_common_reply(Reply, Msg, GS2State = #gs2_state { name = Name, debug = Debug}) -> case Reply of {noreply, NState} -> - Debug1 = common_debug(Debug, {?MODULE, print_event}, Name, + Debug1 = common_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(GS2State #gs2_state { state = NState, time = infinity, debug = Debug1 }); {noreply, NState, Time1} -> - Debug1 = common_debug(Debug, {?MODULE, print_event}, Name, + Debug1 = common_debug(Debug, fun print_event/3, Name, {noreply, NState}), loop(GS2State #gs2_state { state = NState, time = Time1, @@ -894,7 +897,7 @@ handle_common_termination(Reply, Msg, GS2State) -> reply(Name, {To, Tag}, Reply, State, Debug) -> reply({To, Tag}, Reply), sys:handle_debug( - Debug, {?MODULE, print_event}, Name, {out, Reply, To, State}). + Debug, fun print_event/3, Name, {out, Reply, To, State}). %%----------------------------------------------------------------- @@ -903,10 +906,6 @@ reply(Name, {To, Tag}, Reply, State, Debug) -> system_continue(Parent, Debug, GS2State) -> loop(GS2State #gs2_state { parent = Parent, debug = Debug }). --ifdef(use_specs). --spec system_terminate(_, _, _, [_]) -> no_return(). --endif. - system_terminate(Reason, _Parent, Debug, GS2State) -> terminate(Reason, [], GS2State #gs2_state { debug = Debug }). diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 15897dfa..3388e5e7 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -47,7 +47,7 @@ -ifdef(use_specs). --export_type([username/0, password/0]). +-export_type([username/0, password/0, password_hash/0]). -type(permission_atom() :: 'configure' | 'read' | 'write'). -type(username() :: binary()). @@ -75,7 +75,7 @@ -spec(change_password_hash/2 :: (username(), password_hash()) -> 'ok'). -spec(set_admin/1 :: (username()) -> 'ok'). -spec(clear_admin/1 :: (username()) -> 'ok'). --spec(list_users/0 :: () -> [username()]). +-spec(list_users/0 :: () -> [{username(), boolean()}]). -spec(lookup_user/1 :: (username()) -> rabbit_types:ok(rabbit_types:user()) | rabbit_types:error('not_found')). diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 45d14a97..5cdd0e3c 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -162,7 +162,7 @@ -spec(set_maximum_since_use/2 :: (pid(), non_neg_integer()) -> 'ok'). -spec(maybe_expire/1 :: (pid()) -> 'ok'). -spec(on_node_down/1 :: (node()) -> 'ok'). --spec(pseudo_queue/2 :: (binary(), pid()) -> rabbit_types:amqqueue()). +-spec(pseudo_queue/2 :: (name(), pid()) -> rabbit_types:amqqueue()). -endif. @@ -361,7 +361,7 @@ consumers(#amqqueue{ pid = QPid }) -> delegate_call(QPid, consumers, infinity). consumers_all(VHostPath) -> - lists:concat( + lists:append( map(VHostPath, fun (Q) -> [{Q#amqqueue.name, ChPid, ConsumerTag, AckRequired} || {ChPid, ConsumerTag, AckRequired} <- consumers(Q)] diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index 722573c7..b2997ae2 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -75,9 +75,12 @@ rabbit_types:encoded_content()). -spec(clear_encoded_content/1 :: (rabbit_types:content()) -> rabbit_types:unencoded_content()). --spec(map_exception/3 :: (non_neg_integer(), rabbit_types:amqp_error(), +-spec(map_exception/3 :: (rabbit_channel:channel_number(), + rabbit_types:amqp_error() | any(), rabbit_types:protocol()) -> - {boolean(), non_neg_integer(), rabbit_framing:amqp_method()}). + {boolean(), + rabbit_channel:channel_number(), + rabbit_framing:amqp_method_record()}). -endif. diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 3765a088..9d1399f7 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -60,7 +60,7 @@ rabbit_types:ok_or_error(rabbit_types:amqp_error()))). -type(bindings() :: [rabbit_types:binding()]). --opaque(deletions() :: dict:dictionary()). +-opaque(deletions() :: dict()). -spec(recover/0 :: () -> [rabbit_types:binding()]). -spec(exists/1 :: (rabbit_types:binding()) -> boolean() | bind_errors()). @@ -94,9 +94,9 @@ -spec(process_deletions/1 :: (deletions()) -> 'ok'). -spec(combine_deletions/2 :: (deletions(), deletions()) -> deletions()). -spec(add_deletion/3 :: (rabbit_exchange:name(), - {'undefined' | rabbit_types:binding_source(), + {'undefined' | rabbit_types:exchange(), 'deleted' | 'not_deleted', - deletions()}, deletions()) -> deletions()). + bindings()}, deletions()) -> deletions()). -spec(new_deletions/0 :: () -> deletions()). -endif. diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 99837609..19613a57 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -87,7 +87,7 @@ -spec(do/3 :: (pid(), rabbit_framing:amqp_method_record(), rabbit_types:maybe(rabbit_types:content())) -> 'ok'). -spec(shutdown/1 :: (pid()) -> 'ok'). --spec(send_command/2 :: (pid(), rabbit_framing:amqp_method()) -> 'ok'). +-spec(send_command/2 :: (pid(), rabbit_framing:amqp_method_record()) -> 'ok'). -spec(deliver/4 :: (pid(), rabbit_types:ctag(), boolean(), rabbit_amqqueue:qmsg()) -> 'ok'). diff --git a/src/rabbit_framing.erl b/src/rabbit_framing.erl new file mode 100644 index 00000000..a0c8f4d5 --- /dev/null +++ b/src/rabbit_framing.erl @@ -0,0 +1,64 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (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.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +%% License for the specific language governing rights and limitations +%% under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2010 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2010 Rabbit Technologies Ltd. +%% +%% All Rights Reserved. +%% +%% Contributor(s): ______________________________________. +%% + +%% TODO auto-generate + +-module(rabbit_framing). + +-ifdef(use_specs). + +-export_type([protocol/0, + amqp_field_type/0, amqp_property_type/0, + amqp_table/0, amqp_array/0, amqp_value/0, + amqp_method_name/0, amqp_method/0, amqp_method_record/0, + amqp_method_field_name/0, amqp_property_record/0, + amqp_exception/0, amqp_exception_code/0, amqp_class_id/0]). + +-type(protocol() :: 'rabbit_framing_amqp_0_8' | 'rabbit_framing_amqp_0_9_1'). + +-define(protocol_type(T), type(T :: rabbit_framing_amqp_0_8:T | + rabbit_framing_amqp_0_9_1:T)). + +-?protocol_type(amqp_field_type()). +-?protocol_type(amqp_property_type()). +-?protocol_type(amqp_table()). +-?protocol_type(amqp_array()). +-?protocol_type(amqp_value()). +-?protocol_type(amqp_method_name()). +-?protocol_type(amqp_method()). +-?protocol_type(amqp_method_record()). +-?protocol_type(amqp_method_field_name()). +-?protocol_type(amqp_property_record()). +-?protocol_type(amqp_exception()). +-?protocol_type(amqp_exception_code()). +-?protocol_type(amqp_class_id()). + +-endif. diff --git a/src/rabbit_invariable_queue.erl b/src/rabbit_invariable_queue.erl index 671634c4..5a0532ea 100644 --- a/src/rabbit_invariable_queue.erl +++ b/src/rabbit_invariable_queue.erl @@ -52,7 +52,7 @@ -type(state() :: #iv_state { queue :: queue(), qname :: rabbit_amqqueue:name(), len :: non_neg_integer(), - pending_ack :: dict:dictionary() + pending_ack :: dict() }). -include("rabbit_backing_queue_spec.hrl"). diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index e5c30c06..d5c8bd49 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -129,8 +129,8 @@ -spec(enable_cover/0 :: () -> ok_or_error()). -spec(start_cover/1 :: ([{string(), string()} | string()]) -> 'ok'). -spec(report_cover/0 :: () -> 'ok'). --spec(enable_cover/1 :: (file:filename()) -> ok_or_error()). --spec(report_cover/1 :: (file:filename()) -> 'ok'). +-spec(enable_cover/1 :: ([file:filename() | atom()]) -> ok_or_error()). +-spec(report_cover/1 :: ([file:filename() | atom()]) -> 'ok'). -spec(throw_on_error/2 :: (atom(), thunk(rabbit_types:error(any()) | {ok, A} | A)) -> A). -spec(with_exit_handler/2 :: (thunk(A), thunk(A)) -> A). @@ -178,10 +178,8 @@ -spec(recursive_delete/1 :: ([file:filename()]) -> rabbit_types:ok_or_error({file:filename(), any()})). --spec(dict_cons/3 :: (any(), any(), dict:dictionary()) -> - dict:dictionary()). --spec(orddict_cons/3 :: (any(), any(), orddict:dictionary()) -> - orddict:dictionary()). +-spec(dict_cons/3 :: (any(), any(), dict()) -> dict()). +-spec(orddict_cons/3 :: (any(), any(), orddict:orddict()) -> orddict:orddict()). -spec(unlink_and_capture_exit/1 :: (pid()) -> 'ok'). -spec(get_options/2 :: ([optdef()], [string()]) -> {[string()], [{string(), any()}]}). @@ -270,29 +268,30 @@ rs(#resource{virtual_host = VHostPath, kind = Kind, name = Name}) -> lists:flatten(io_lib:format("~s '~s' in vhost '~s'", [Kind, Name, VHostPath])). -enable_cover() -> - enable_cover("."). +enable_cover() -> enable_cover(["."]). -enable_cover([Root]) when is_atom(Root) -> - enable_cover(atom_to_list(Root)); -enable_cover(Root) -> - case cover:compile_beam_directory(filename:join(Root, "ebin")) of - {error,Reason} -> {error,Reason}; - _ -> ok - end. +enable_cover(Dirs) -> + lists:foldl(fun (Dir, ok) -> + case cover:compile_beam_directory( + filename:join(lists:concat([Dir]),"ebin")) of + {error, _} = Err -> Err; + _ -> ok + end; + (_Dir, Err) -> + Err + end, ok, Dirs). start_cover(NodesS) -> {ok, _} = cover:start([makenode(N) || N <- NodesS]), ok. -report_cover() -> - report_cover("."). +report_cover() -> report_cover(["."]). + +report_cover(Dirs) -> [report_cover1(lists:concat([Dir])) || Dir <- Dirs], ok. -report_cover([Root]) when is_atom(Root) -> - report_cover(atom_to_list(Root)); -report_cover(Root) -> +report_cover1(Root) -> Dir = filename:join(Root, "cover"), - ok = filelib:ensure_dir(filename:join(Dir,"junk")), + ok = filelib:ensure_dir(filename:join(Dir, "junk")), lists:foreach(fun (F) -> file:delete(F) end, filelib:wildcard(filename:join(Dir, "*.html"))), {ok, SummaryFile} = file:open(filename:join(Dir, "summary.txt"), [write]), diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 682a7faa..fd84109b 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -130,7 +130,7 @@ -type(client_msstate() :: #client_msstate { server :: server(), client_ref :: client_ref(), - file_handle_cache :: dict:dictionary(), + file_handle_cache :: dict(), index_state :: any(), index_module :: atom(), dir :: file:filename(), @@ -164,8 +164,8 @@ -spec(set_maximum_since_use/2 :: (server(), non_neg_integer()) -> 'ok'). -spec(has_readers/2 :: (non_neg_integer(), gc_state()) -> boolean()). -spec(combine_files/3 :: (non_neg_integer(), non_neg_integer(), gc_state()) -> - non_neg_integer()). --spec(delete_file/2 :: (non_neg_integer(), gc_state()) -> non_neg_integer()). + 'ok'). +-spec(delete_file/2 :: (non_neg_integer(), gc_state()) -> 'ok'). -endif. diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 28d0b47d..bde9b3d3 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -190,7 +190,7 @@ unacked :: non_neg_integer() })). -type(seq_id() :: integer()). --type(seg_dict() :: {dict:dictionary(), [segment()]}). +-type(seg_dict() :: {dict(), [segment()]}). -type(qistate() :: #qistate { dir :: file:filename(), segments :: 'undefined' | seg_dict(), journal_handle :: hdl(), diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index afc383d6..7f7bd9d8 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -163,7 +163,7 @@ -ifdef(use_specs). -type(start_heartbeat_fun() :: - fun ((rabbit_networking:socket(), non_neg_integer()) -> + fun ((rabbit_net:socket(), non_neg_integer()) -> rabbit_heartbeat:heartbeaters())). -spec(start_link/3 :: (pid(), pid(), start_heartbeat_fun()) -> @@ -180,10 +180,10 @@ -spec(init/4 :: (pid(), pid(), pid(), start_heartbeat_fun()) -> no_return()). -spec(start_connection/7 :: (pid(), pid(), pid(), start_heartbeat_fun(), any(), - rabbit_networking:socket(), - fun ((rabbit_networking:socket()) -> + rabbit_net:socket(), + fun ((rabbit_net:socket()) -> rabbit_types:ok_or_error2( - rabbit_networking:socket(), any()))) -> no_return()). + rabbit_net:socket(), any()))) -> no_return()). -endif. diff --git a/src/rabbit_ssl.erl b/src/rabbit_ssl.erl index 4335dd2e..5b905682 100644 --- a/src/rabbit_ssl.erl +++ b/src/rabbit_ssl.erl @@ -85,8 +85,8 @@ peer_cert_validity(Cert) -> cert_info(F, Cert) -> F(case public_key:pkix_decode_cert(Cert, otp) of - {ok, DecCert} -> DecCert; - DecCert -> DecCert + {ok, DecCert} -> DecCert; %%pre R14B + DecCert -> DecCert %%R14B onwards end). %%-------------------------------------------------------------------------- diff --git a/src/rabbit_types.erl b/src/rabbit_types.erl index 7f5ff609..b9993823 100644 --- a/src/rabbit_types.erl +++ b/src/rabbit_types.erl @@ -147,7 +147,7 @@ -type(connection() :: pid()). --type(protocol() :: 'rabbit_framing_amqp_0_8' | 'rabbit_framing_amqp_0_9_1'). +-type(protocol() :: rabbit_framing:protocol()). -type(user() :: #user{username :: rabbit_access_control:username(), diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index f88e49c2..69d62fde 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -305,7 +305,7 @@ q3 :: bpqueue:bpqueue(), q4 :: queue(), next_seq_id :: seq_id(), - pending_ack :: dict:dictionary(), + pending_ack :: dict(), index_state :: any(), msg_store_clients :: 'undefined' | {{any(), binary()}, {any(), binary()}}, diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index aa986e54..50bca390 100644 --- a/src/rabbit_writer.erl +++ b/src/rabbit_writer.erl @@ -62,9 +62,10 @@ (pid(), rabbit_framing:amqp_method_record(), rabbit_types:content()) -> 'ok'). -spec(send_command_sync/2 :: - (pid(), rabbit_framing:amqp_method()) -> 'ok'). + (pid(), rabbit_framing:amqp_method_record()) -> 'ok'). -spec(send_command_sync/3 :: - (pid(), rabbit_framing:amqp_method(), rabbit_types:content()) -> 'ok'). + (pid(), rabbit_framing:amqp_method_record(), rabbit_types:content()) + -> 'ok'). -spec(send_command_and_notify/5 :: (pid(), pid(), pid(), rabbit_framing:amqp_method_record(), rabbit_types:content()) diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 93adfcb1..46bab31d 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -357,8 +357,7 @@ handle_cast({delayed_restart, {RestartType, Reason, Child}}, State) when ?is_simple(State) -> {ok, NState} = do_restart(RestartType, Reason, Child, State), {noreply, NState}; -handle_cast({delayed_restart, {RestartType, Reason, Child}}, State) - when not (?is_simple(State)) -> +handle_cast({delayed_restart, {RestartType, Reason, Child}}, State) -> case get_child(Child#child.name, State) of {value, Child} -> {ok, NState} = do_restart(RestartType, Reason, Child, State), |