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

tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
asiniy
Hey there! I wrote a download elixir package which does exactly what its name about - an easy way to download files. I saw solutions ab...
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
Crowdhailer
I have been updating a library that allows you to pipe between functions that use the erlang result tuple convention. Assuming you have ...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New
wfgilman
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
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