[erlang-questions] Persistent processes

Ladislav Lenart lenartlad@REDACTED
Tue Jul 10 18:00:57 CEST 2007


Kirill Zaborski wrote:
> So the persistent process calls some module:perstist_state(SomeState)?
> And then after restart some utility process runs
> persistent_process:start(SomeState)?
> Quite reasonable, thanks.

Well,

in our case each persistent entity is uniquely identified
by an address. So the process itself stores its state using
something like

   module:persist_state(Address, State)

and is (re)started by

   persistent_process:start(Address) or
   persistent_process:start_link(Address)

Newly started process (a gen_server) fetches and restores
its state during its init. It also writes Address -> self()
to second (ram_copies) mapping table.

Ladislav Lenart




More information about the erlang-questions mailing list