[erlang-questions] ANN: locks (beta) - distributed lock manager and leader election

Ulf Wiger <>
Wed Oct 9 21:41:38 CEST 2013


Right after I sent this, of course I found some issues with the locks_leader and recovery from netsplits - It did it, but it wasn't exactly elegant. Did I mention it was a Beta release…?

Now it's a lot better, at least in my tests.

There is now also some documentation of the locks_leader callback under
https://github.com/uwiger/locks/blob/master/examples/doc/test_cb.md

and the gdict example actually merges the dictionaries after netsplit, albeit in a very non-optimal way.


The real nerds may take a look at the locks_watcher code,

https://github.com/uwiger/locks/blob/master/src/locks_watcher.erl#L12

which expands a pseudo-call in the locks_agent into a remote spawn of an interpreted
function, which watches for the locks_server to come up on another node.

What I think is a bit cool is that the interpreted code is actually implemented as regular
code in this module (lines 22-65). The parse_transform lifts and abstracts the code into
something that becomes interpreted at runtime.

The end result is that locks_agents react immediately to a locks_server starting on
another node - no polling required.

BR,
Ulf W

On 8 Oct 2013, at 11:58, Ulf Wiger <> wrote:

> 
> https://github.com/uwiger/locks/
> 
> Many of you have heard me talk about a lock manager that I've been working on.
> 
> I think it's now in a state where I can invite people to take it for a spin. Some of you may be
> interested primarily in the gen_leader-like leader election behavior. You may jump directly to that
> description below.
> ...

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-questions mailing list