Skip to content

Instantly share code, notes, and snippets.

@argv0
Created May 18, 2010 14:15
Show Gist options
  • Select an option

  • Save argv0/405047 to your computer and use it in GitHub Desktop.

Select an option

Save argv0/405047 to your computer and use it in GitHub Desktop.
ring_trans(Fun, Args) ->
gen_server2:call(?MODULE, {ring_trans, Fun, Args}).
...
handle_call({ring_trans, Fun, Args}, _From, State) ->
{ok, Ring} = get_my_ring(),
case catch Fun(Ring, Args) of
{new_ring, NewRing} ->
set_my_ring(NewRing),
{reply, {ok, NewRing}, State};
_ ->
{reply, not_changed, State}
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment