mudasobwa

mudasobwa

Creator of Cure

Peeper - a library to keep state between crashes and move processes across supervisors

Peeper is a library, that allows to preserve state between process crashes (including ETS and process dictionary,) as well as moving processes across dynamic supervisors (including a distributed transfer across nodes.)

It keeps both process dictionary and private ETS private. The caveat is all the incoming async messages during a process transfer are to be lost and the huge ETS would have been copied across nodes, which might be not an option.

Excerpt from tests:

    {:ok, source_pid} = DynamicSupervisor.start_link(name: SDS)
    {:ok, pid} = DynamicSupervisor.start_child(SDS, {MyProcess, state: 0, name: P})

    assert 0 == Peeper.call(P, :state)
    # creates a private ETS with ‹CONTENT›
    assert :ok == Peeper.cast(pid, {:create_ets, :my_ets})
    # amends process dictionary
    assert :ok == Peeper.cast(pid, {:set_pd, :foo, 42})
    # amends process state
    assert :ok == Peeper.cast(pid, :inc)
    assert 1 == Peeper.call(P3, :state)

    Process.exit(Peeper.Supervisor.worker(pid), :kill)

    assert 1 == Peeper.call(P, :state)
    assert 42 == Peeper.call(P, {:get_pd, :foo})
    assert ‹ETS CONTENT› = Peeper.call(P, {:ets, :my_ets})

    {:ok, target_pid} = DynamicSupervisor.start_link(name: TDS)

    Peeper.transfer(P3, source_pid, target_pid)

    assert [{:undefined, pid, :supervisor, _}] = DynamicSupervisor.which_children(TDS)
    assert pid == GenServer.whereis(P)
    assert 1 == Peeper.call(P, :state)
    assert 42 == Peeper.call(P, {:get_pd, :foo})
    assert ‹ETS CONTENT› = Peeper.call(P, {:ets, :my_ets})

https://github.com/am-kantox/peeper

Most Liked

mudasobwa

mudasobwa

Creator of Cure

terminate/2 callback is not guaranteed to be called, unfortunately.

Where Next?

Popular in Announcing Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43487 311
New
mathieuprog
Hello :waving_hand: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First a...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamPipe ...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 14482 100
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement