• Stars
    star
    311
  • Rank 129,686 (Top 3 %)
  • Language Gleam
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated about 2 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
14,118
star
2

awesome-gleam

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

stdlib

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

mix_gleam

โš—๏ธ Build Gleam code with mix
Elixir
132
star
5

http

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

vscode-gleam

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

website

๐Ÿก Gleam's website and guide
HTML
69
star
8

example-todomvc

๐Ÿ“ An example web application in Gleam
Gleam
66
star
9

gleam.vim

โœŒ๏ธ Gleam support for Vim/Neovim
Vim Script
64
star
10

example-echo-server

๐Ÿ”— An example Gleam web application
Gleam
64
star
11

cowboy

๐Ÿค  A Gleam HTTP service adapter for the Cowboy web server
Gleam
53
star
12

tree-sitter-gleam

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

gleam-mode

๐Ÿ™ Gleam support for Emacs
Emacs Lisp
48
star
14

erlang

๐Ÿ™ Extra code for when running on Erlang
Gleam
47
star
15

language-tour

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

httpc

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

elli

๐Ÿ› A Gleam HTTP service adapter for the Elli web server
Gleam
44
star
18

json

๐Ÿ‘ Work with JSON in Gleam!
Gleam
43
star
19

packages

๐Ÿ“ฆ Search for Gleam packages
Gleam
41
star
20

example-lisp-interpreter

๐Ÿ‘พ A Lisp interpreter in Gleam!
Gleam
31
star
21

plug

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

hackney

๐Ÿช Make requests to HTTP servers with Hackney
Gleam
29
star
23

javascript

๐ŸŒผ Extra code for when running on JavaScript
Gleam
29
star
24

fetch

๐Ÿ“ก Make requests to HTTP servers with fetch
Gleam
27
star
25

suggestions

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

crypto

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

template-gleam-javascript

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

setup-erlang

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

hexpm-rust

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

setup-gleam

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

rebar_gleam

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

bitwise

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

developer-survey

๐Ÿ—บ Learning about the Gleam community
Gleam
10
star
34

gleam-highlight.js

๐ŸŽจ Gleam syntax highlighting with Highlight.js
JavaScript
9
star
35

gleam-v0.17-example

JavaScript
7
star
36

branding

7
star
37

exercism-gleam

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

gleam-compiler-ci-test

Rust
5
star
39

should_assertions

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

package-interface

๐Ÿ“ฆ Work with Gleam's package interfaces
Gleam
4
star
41

.github

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

hexpm

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

playground

Gleam
1
star