Skip to content
This repository has been archived by the owner on Aug 24, 2018. It is now read-only.

soranoba/gcyclic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gcyclic

Build Status

Generate cyclic message passing server.

Overview

We sometimes want to create process groups that do the message passing to each other. (A <=> B <=> C <=> A)

There is also a way to use the process name, but this will provide the other way.

Usage

%% rebar.config (rebar3)
{deps, [
        {gcyclic, ".*", {git, "git://github.com/soranoba/gcyclic.git", {branch, "master"}}}
       ]}.
%% supervisor
-module(sample_supervisor).
-behaviour(gcyclic_supervisor).

start_link() ->
    gcyclic_supervisor:start_link(?MODULE, []).

init([]) ->
    {ok, {{one_for_all, 5, 10},
          [
           {Mod1, {Mod1, start_link, []}, permanent, 5000, worker, [Mod1]},
           {Mod2, {Mod2, start_link, []}, permanent, 5000, worker, [Mod2]},
           {Mod3, {Mod3, start_link, []}, permanent, 5000, worker, [Mod3]},
          ]}}.

Attention

strategy only support the one_for_all.

Because, It is difficult to generalize when only part of processes restarts.

Also, change of strategy by the appup can not support.

start_child MUST NOT be used.

When you allow start_child, it need to consider that there exist only the part of processes.

About

Generate cyclic message passing server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published