Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfAfg committed Feb 27, 2024
1 parent a8c9e1e commit d61f249
Showing 1 changed file with 43 additions and 17 deletions.
60 changes: 43 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
bean
=====
# bean

A rebar plugin
bean is a Rebar3 plugin that automatically generates a supervision tree based on dependencies between processes. With this plugin, you can automatically generate a supervision tree that satisfies the following requirements simply by running this:

Build
-----
- The number of processes restarted at one time is minimal.
- All processes that depend on the terminated process are restarted.

$ rebar3 compile
Dependencies between processes are defined as the directions of communication between processes. For example, if process $p_1$ sends a message to process $p_2$, then "$`p_2`$ is dependent on $p_1$".

Use
---
## Use

Add the plugin to your rebar config:
Add this plugin to your `rebar.config`:

{plugins, [
{bean, {git, "https://host/user/bean.git", {tag, "0.1.0"}}}
]}.
```erlang
{plugins, [
{bean, {git, "https://github.com/ajfAfg/bean.git", {tag, "0.1.0"}}}
]}.
```

Then just call your plugin directly in an existing application:
Then just call the plugin directly in an existing application:

```sh
$ rebar3 bean
===> Fetching bean
===> Compiling bean
<Plugin Output>
```

$ rebar3 bean
===> Fetching bean
===> Compiling bean
<Plugin Output>
See [the demo project](./demo) for a complete example of this plugin.

## Specifications

- The supervision tree supervise the processes defined under the floor of `src` directory.
- The supervisor source codes are output to `src/bean` directory.
- The name of the root in the supervision tree is `bean`.
- Supported restart strategies are `one_for_one`, `one_for_all`, and `rest_for_one` only.
- i.e. `simple_one_for_one` is not supported.

## Limitations

Currently, bean has the following limitations:

- Only supports gen_server processes.
- Only `gen_server:call/2,3` and `gen_server:cast/2` communications are supported.
- Extractable communications are only those at the top level of the scope of each callback function of the module that implements gen_server.
- It is also assumed that the first argument of each communication function is a literal representing the name of the gen_server.

## More information

The supervision tree generation algorithm implemented in this plugin is proven to output a certain optimal tree. In addition, experimental results show that the algorithm is fast enough for many realistic cases, although it takes the worst-case exponential time. See the master's thesis "[Automatic Generation of an Optimal Supervision Tree in Erlang]()" for details.

TODO: Add the link to the thesis when it is published.

0 comments on commit d61f249

Please sign in to comment.