C0 code coverage information

Generated on 2009-08-09 21:22:56 with etap 0.3.4.

Name Total lines Lines of code Total coverage Code coverage
couch_external_server ?? ?? ??
0% 
....1 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
....2 % use this file except in compliance with the License. You may obtain a copy of
....3 % the License at
....4 %
....5 %   http://www.apache.org/licenses/LICENSE-2.0
....6 %
....7 % Unless required by applicable law or agreed to in writing, software
....8 % distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
....9 % WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
...10 % License for the specific language governing permissions and limitations under
...11 % the License.
...12 
...13 -module(couch_external_server).
...14 -behaviour(gen_server).
...15 
...16 -export([start_link/2, stop/1, execute/2]).
...17 -export([init/1, terminate/2, handle_call/3, handle_cast/2, handle_info/2, code_change/3]).
...18 
...19 -include("couch_db.hrl").
...20 
...21 % External API
...22 
...23 start_link(Name, Command) ->
...24     gen_server:start_link(couch_external_server, [Name, Command], []).
...25 
...26 stop(Pid) ->
...27     gen_server:cast(Pid, stop).
...28 
...29 execute(Pid, JsonReq) ->
...30     gen_server:call(Pid, {execute, JsonReq}, infinity).
...31 
...32 % Gen Server Handlers
...33 
...34 init([Name, Command]) ->
...35     ?LOG_INFO("EXTERNAL: Starting process for: ~s", [Name]),
...36     ?LOG_INFO("COMMAND: ~s", [Command]),
...37     {ok, Pid} = couch_os_process:start_link(Command),
...38     {ok, {Name, Command, Pid}}.
...39 
...40 terminate(_Reason, {_Name, _Command, Pid}) ->
...41     couch_os_process:stop(Pid),
...42     ok.
...43 
...44 handle_call({execute, JsonReq}, _From, {Name, Command, Pid}) ->
...45     {reply, couch_os_process:prompt(Pid, JsonReq), {Name, Command, Pid}}.
...46 
...47 handle_info({'EXIT', Pid, Reason}, {Name, Command, Pid}) ->
...48     ?LOG_INFO("EXTERNAL: Process for ~s exiting. (reason: ~w)", [Name, Reason]),
...49     {stop, normal, {Name, Command, Pid}}.
...50 
...51 handle_cast(stop, {Name, Command, Pid}) ->
...52     ?LOG_INFO("EXTERNAL: Shutting down ~s", [Name]),
...53     exit(Pid, normal),
...54     {stop, normal, {Name, Command, Pid}};
...55 handle_cast(_Whatever, State) ->
...56     {noreply, State}.
...57 
...58 code_change(_OldVsn, State, _Extra) ->
...59     {ok, State}.
...60 
...61 

Generated using etap 0.3.4.