REST Centralized Locking System for distributed systems that provide
-
100% guarantee of exclusive access. If 2 separate system managed to get access to the same resource, an unrecoverable corruption might occur. (Done)
-
If an exclusive access is granted to one of the services, and the service crashed or died without releasing the locks, the locking system must free the lock on that resource (eventually), so other services doesn’t get blocked forever.
-
Support timeout, if a service can’t get an exclusive lock to a resource after the given timeout. (Done)
-
Detect deadlocks. [Optional]
-
resource is defined by it’s name. This name is used as a key to acquire the locking. (Done)
Accepts 2 params id
and resource
to ask for permission to lock that resource.
Responds with either a success
or timeout
Accepts 2 params id
and resource
to release the resource.
Responds with either a success
or failure
if the caller was not locking the resource.
Project is far from complete, here's what's still missing:
- Add timeout to resource's lock to avoid if client crashed and did not release the lock
- Deadlock detection support
- Test Coverage
- Move queue to redis or proper queue to support running app on mulitple workers