Applied sciences and design patterns of Erlang/OTP have been confirmed through the years. Now in Golang. As much as x5 occasions quicker than authentic Erlang/OTP by way of community messaging. The best technique to create an OTP-designed software in Golang.
Objective
This undertaking goals to leverage Erlang/OTP expertise with Golang efficiency. Ergo Framework implements DIST protocol, ETF information format and OTP design patterns gen.Server
, gen.Supervisor
, gen.Utility
which makes you in a position to create distributed, excessive efficiency and dependable microservice options having native integration with Erlang infrastructure
Options
- Assist Erlang 24 (together with Alias and Distant Spawn options)
- Spawn Erlang-like processes
- Register/unregister processes with easy atom
gen.Server
habits assist (with atomic state)gen.Supervisor
habits assist with all recognized restart methods assist- One For One
- One For All
- Relaxation For One
- Easy One For One
gen.Utility
habits assist with all recognized beginning sorts assist- Everlasting
- Short-term
- Transient
gen.Stage
habits assist (originated from Elixir’s GenStage). That is abstraction constructed on prime ofgen.Server
to supply a easy technique to create a distributed Producer/Shopper structure, whereas routinely managing the idea of backpressure. This implementation is absolutely appropriate with Elixir’s GenStage. Instance is right here examples/genstage or simply rungo run ./examples/genstage
to see it in motiongen.Saga
habits assist. It implements Saga design sample – a sequence of transactions that updates every service state and publishes the end result (or cancels the transaction or triggers the subsequent transaction step).gen.Saga
additionally supplies a characteristic of interim outcomes (can be utilized as transaction progress or as part of pipeline processing), time deadline (to restrict transaction lifespan), two-phase commit (to make distributed transaction atomic). Right here is instance examples/gensaga.gen.Raft
habits assist. It’s improved implementation of Raft consensus algorithm. The important thing enchancment is utilizing quorum below the hood to handle the chief election course of and make the Raft cluster extra dependable. This implementation helps quorums of three, 5, 7, 9, or 11 quorum members. Right here is an instance of this characteristic examples/genraft.- Connect with (settle for connection from) any Erlang/Elixir node inside a cluster
- Making sync request
ServerProcess.Name
, async –ServerProcess.Solid
orCourse of.Ship
in style ofgen_server:name
,gen_server:forged
,erlang:ship
accordingly - Monitor processes/nodes, native/distant
- Hyperlink processes native/distant
- RPC callbacks assist
- embedded EPMD (with a purpose to do away with erlang’ dependencies)
- Unmarshalling phrases into the struct utilizing
etf.TermIntoStruct
,etf.TermProplistIntoStruct
or to the string utilizingetf.TermToString
- Customized marshaling/unmarshaling through
Marshal
andUnmarshal
interfaces - Encryption (TLS 1.3) assist (together with autogenerating self-signed certificates)
- Compression assist (with customization of compression degree and threshold). It may be configured for the node or a specific course of.
- Proxy assist with end-to-end encryption, includeing compression/fragmentation/linking/monitoring options.
- Examined and confirmed assist Home windows, Darwin (MacOS), Linux, FreeBSD.
- Zero dependencies. All options are applied utilizing the usual Golang library.