Skip to content

khaledkbadr/centralized_locking_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Centralized Locking System

REST Centralized Locking System for distributed systems that provide

Requirements

  1. 100% guarantee of exclusive access. If 2 separate system managed to get access to the same resource, an unrecoverable corruption might occur. (Done)

  2. 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.

  3. Support timeout, if a service can’t get an exclusive lock to a resource after the given timeout. (Done)

  4. Detect deadlocks. [Optional]

  5. resource is defined by it’s name. This name is used as a key to acquire the locking. (Done)

Endpoints Specs

/resource/access (POST)

Accepts 2 params id and resource to ask for permission to lock that resource.

Responds with either a success or timeout

/resource/release (POST)

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.

Enhancements:

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages