github.com/ergo-services/ergo@v1.999.224/gen/README.md (about)

     1  
     2  ## Generic behaviors ##
     3  
     4  ### Server
     5    Generic server behavior.
     6  
     7  Example: [gen.Server](https://github.com/ergo-services/examples/tree/master/genserver)
     8  
     9  ### Supervisor
    10    Generic supervisor behavior.
    11  
    12  A supervisor is responsible for starting, stopping, and monitoring its child processes. The basic idea of a supervisor is that it is to keep its child processes alive by restarting them when necessary.
    13  
    14  Example: [gen.Supervisor](https://github.com/ergo-services/examples/tree/master/supervisor)
    15  
    16  ### Application
    17    Generic application behavior.
    18  
    19  Example: [gen.Application](https://github.com/ergo-services/examples/tree/master/application)
    20  
    21  ### Pool
    22    Generic pool of workers.
    23  
    24    This behavior implements a basic design pattern with a pool of workers. All messages/requests received by the pool process are forwarded to the workers using the "Round Robin" algorithm. The worker process is automatically restarting on termination.
    25  
    26  Example: [gen.Pool](https://github.com/ergo-services/examples/tree/master/genpool)
    27  
    28  ### Web
    29    Web API Gateway behavior.
    30  
    31    The Web API Gateway pattern is also sometimes known as the "Backend For Frontend" (BFF)  because you build it while thinking about the needs of the client app. Therefore, BFF sits between the client apps and the microservices. It acts as a reverse proxy, routing requests from clients to services.
    32  
    33  Example: [gen.Web](https://github.com/ergo-services/examples/tree/master/genweb)
    34  
    35  ### TCP
    36    Socket acceptor pool for TCP protocols.
    37  
    38    This behavior aims to provide everything you need to accept TCP connections and process packets with a small code base and low latency while being easy to use.
    39  
    40  Example: [gen.TCP](https://github.com/ergo-services/examples/tree/master/gentcp)
    41  
    42  ### UDP
    43    UDP acceptor pool for UDP protocols
    44  
    45    This behavior provides the same feature set as TCP but for handling UDP packets using pool of handlers.
    46  
    47  Example: [gen.UDP](https://github.com/ergo-services/examples/tree/master/genudp)
    48  
    49  ### Stage
    50    Generic stage behavior (originated from Elixir's [GenStage](https://hexdocs.pm/gen_stage/GenStage.html)).
    51  
    52  This is abstraction built on top of `gen.Server` to provide a simple way to create a distributed Producer/Consumer architecture, while automatically managing the concept of backpressure. This implementation is fully compatible with Elixir's GenStage.
    53  
    54  Example: [gen.Stage](https://github.com/ergo-services/examples/tree/master/genstage)
    55  
    56  ### Saga
    57    Generic saga behavior.
    58  
    59  It implements Saga design pattern - a sequence of transactions that updates each service state and publishes the result (or cancels the transaction or triggers the next transaction step). `gen.Saga` also provides a feature of interim results (can be used as transaction progress or as a part of pipeline processing), time deadline (to limit transaction lifespan), two-phase commit (to make distributed transaction atomic).
    60  
    61  Example: [gen.Saga](https://github.com/ergo-services/examples/tree/master/gensaga)
    62  
    63  ### Raft
    64    Generic raft behavior.
    65  
    66  It's improved implementation of [Raft consensus algorithm](https://raft.github.io). The key improvement is using quorum under the hood to manage the leader election process and make the Raft cluster more reliable. This implementation supports quorums of 3, 5, 7, 9, or 11 quorum members.
    67  
    68  Example: [gen.Raft](https://github.com/ergo-services/examples/tree/master/genraft)