anchor.diff:  -module(xnest_manager).
  +-include("lager.hrl").
   -behaviour(gen_server).
   
   %% API.
  
positive.code: %% @doc Start the xnest_manager gen_server.
  -spec start_link() -> {ok, pid()}.
  start_link() ->
  	gen_server:start_link(?MODULE, [], []).
  
  %% @doc Get the xnest by name, a new one will be created if the specfied is not exists.
  -spec get_xnest(binary()) -> {ok, pid()}.
  get_xnest(XNestName) ->
  	gen_server:call(?MODULE, {get_xnest, XNestName}).
  
  %% @doc Get current xnest number.
  -spec get_xnest_count() -> integer().
  
negative.code: 			ExistXNest;
  		_ ->
  			{ok, NewXNest} = xnest:start_link(),
  			ets:insert_new(?TAB, {XNestName, NewXNest}),
  			ets:insert_new(?PID_INDEX, {NewXNest, XNestName}),
  			NewXNest	
  	end,
  	{reply, XNest, State};
  
  
  handle_call(_Request, _From, State) ->
  	{reply, ignored, State}.
  
  