• Stars
    star
    413
  • Rank 104,801 (Top 3 %)
  • Language Gleam
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“ซ Fault tolerant multicore programs with actors

Gleam OTP

GitHub release Discord chat CI

A Gleam library for building fault tolerant multi-core programs using the actor model. It is compatible with Erlang's OTP framework.

This library is experimental and will likely have many breaking changes in the future!

Gleamโ€™s actor system is built with a few primary goals:

  • Full type safety of actors and messages.
  • Be compatible with Erlangโ€™s OTP actor framework.
  • Provide fault tolerance and self-healing through supervisors.
  • Have equivalent performance to Erlangโ€™s OTP.

This library documents its abstractions and functionality, but you may also wish to read the documentation or other material on Erlangโ€™s OTP framework to get a fuller understanding of OTP, the problems it solves, and and the motivations for its design.

Usage

Add this library to your Gleam project.

gleam add gleam_otp

Actor hierarchy

This library provides several different types of actor that can be used in Gleam programs.

Process

The process is the lowest level building block of OTP, all other actors are built on top of processes either directly or indirectly. Typically this abstraction would be not be used very often in Gleam applications, favour other actor types that provide more functionality.

Gleam's process module is defined in the gleam_erlang library.

[Documentation]

Actor

The actor is the most commonly used process type in Gleam and serves as a good building block for other abstractions. Like Erlang's gen_server it handles OTP's system messages automatically to enable OTP's debugging and tracing functionality.

[Documentation]

Task

A task is a kind of process that performs a single task and then shuts down. Commonly tasks are used to convert sequential code into concurrent code by performing computation in another process.

[Documentation]

Supervisor

Supervisors is a process that starts and then supervises a group of processes, restarting them if they crash. Supervisors can start other supervisors, resulting in a hierarchical process structure called a supervision tree, providing fault tolerance to a Gleam application.

[Documentation]

Limitations and known issues

This library is experimental there are some limitations that not yet been resolved.

  • There is no support for named processes. They are untyped global mutable variables which may be uninitialized, more research is needed to find a suitable type safe alternative.
  • There are relatively few actor abstractions provided by this library. More will be added in the future.
  • Actors do not yet support all OTP system messages. Unsupported messages are dropped.
  • Supervisors do not yet support different shutdown periods per child. In practice this means that children that are supervisors do not get an unlimited amount of time to shut down, as is expected in Erlang or Elixir.
  • This library has not seen much testing compared to the Erlang OTP libraries, both in terms of unit tests and real world testing in applications.

More Repositories

1

gleam

โญ๏ธ A friendly language for building type-safe, scalable systems!
Rust
17,409
star
2

awesome-gleam

๐Ÿ’ฏ A collection of Gleam libraries, projects, and resources
Gleam
1,225
star
3

stdlib

๐ŸŽ Gleam's standard library
Gleam
454
star
4

http

๐Ÿ•ธ๏ธ Types and functions for HTTP clients and servers!
Gleam
182
star
5

mix_gleam

โš—๏ธ Build Gleam code with mix
Elixir
166
star
6

vscode-gleam

๐Ÿ“Ÿ Gleam support for VS Code
TypeScript
153
star
7

example-todomvc

๐Ÿ“ An example web application in Gleam
Gleam
119
star
8

gleam.vim

โœŒ๏ธ Gleam support for Vim/Neovim
Vim Script
100
star
9

website

๐Ÿก Gleam's website and guide
HTML
90
star
10

json

๐Ÿ‘ Work with JSON in Gleam!
Gleam
86
star
11

language-tour

๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿ’ป Learn Gleam in your browser
Gleam
82
star
12

gleam-mode

๐Ÿ™ Gleam support for Emacs
Emacs Lisp
79
star
13

erlang

๐Ÿ™ Extra code for when running on Erlang
Gleam
79
star
14

example-echo-server

๐Ÿ”— An example Gleam web application
Gleam
75
star
15

tree-sitter-gleam

๐ŸŒณ A tree-sitter grammar for the Gleam programming language
JavaScript
71
star
16

httpc

๐Ÿ“ก Make requests to HTTP servers with httpc
Gleam
70
star
17

packages

๐Ÿ“ฆ Search for Gleam packages
Gleam
67
star
18

cowboy

๐Ÿค  A Gleam HTTP service adapter for the Cowboy web server
Gleam
64
star
19

elli

๐Ÿ› A Gleam HTTP service adapter for the Elli web server
Gleam
60
star
20

javascript

๐ŸŒผ Extra code for when running on JavaScript
Gleam
52
star
21

hackney

๐Ÿช Make requests to HTTP servers with Hackney
Gleam
37
star
22

fetch

๐Ÿ“ก Make requests to HTTP servers with fetch
Gleam
35
star
23

crypto

โ›“๏ธ Crypto functionality for Gleam applications
Gleam
34
star
24

plug

๐Ÿ”Œ A Gleam HTTP service adapter for the Plug web application interface
Elixir
32
star
25

example-lisp-interpreter

๐Ÿ‘พ A Lisp interpreter in Gleam!
Gleam
32
star
26

suggestions

๐Ÿ“™ A place for ideas and feedback
26
star
27

template-gleam-javascript

JavaScript support is built into the Gleam build tool, so this is no longer needed!
JavaScript
24
star
28

setup-erlang

๐Ÿ‘ท Erlang/OTP on GitHub Actions
PowerShell
22
star
29

hexpm-rust

โš—๏ธ A Rust client for the Hex package manager
Rust
21
star
30

playground

Gleam
18
star
31

setup-gleam

๐Ÿ‘ทโ€โ™€๏ธ Gleam on GitHub Actions
Shell
17
star
32

rebar_gleam

๐Ÿงฐ Build Gleam code with rebar3
Erlang
15
star
33

gleam-highlight.js

๐ŸŽจ Gleam syntax highlighting with Highlight.js
JavaScript
11
star
34

developer-survey

๐Ÿ—บ Learning about the Gleam community
Gleam
11
star
35

bitwise

๐Ÿ“ Bitwise operations on integers
Gleam
10
star
36

gleam-v0.17-example

JavaScript
7
star
37

branding

7
star
38

exercism-gleam

Exercises to be ported to https://github.com/exercism/gleam
Rust
6
star
39

package-interface

๐Ÿ“ฆ Work with Gleam's package interfaces
Gleam
5
star
40

gleam-compiler-ci-test

Rust
5
star
41

should_assertions

โ˜๏ธ EUnit compatible assertion functions for use in tests
Gleam
5
star
42

.github

๐Ÿ“œ Organisation wide GitHub configuration files
2
star
43

hexpm

๐Ÿช„ Decoders for the Hex API
Gleam
1
star