/mootex

A light-weight and central mutex source for distributed systems.

Primary LanguageGo

Mootex

A light-weight and central mutex source for distributed systems.

Building

The Binary

make

The Image

docker build -t mootex .

Execution

Binary

./mootex

Container

docker run -d --rm -p 3000 --name mootex mootex

Dockerhub

docker pull hedenface/mootex:0.0.0
docker run -d --rm -p 3000 --name mootex hedenface/mootex:0.0.0

Usage

With any of the execution methods, you should now be able to use your central mutex in a few different ways.

Locking

Query Parameter

curl http://localhost:3000/lock?key=MUTEX-NAME

or

curl http://localhost:3000/lockParameter?key=MUTEX-NAME

Plaintext Payload

curl -X POST -d 'MUTEX-NAME' http://localhost:3000/lockPlaintextBody

JSON Payload

curl -X POST -d '{"key":"MUTEX-NAME"}' http://localhost:3000/lockJSONBody

Unlocking

Query Parameter

curl http://localhost:3000/unlock?key=MUTEX-NAME

or

curl http://localhost:3000/unlockParameter?key=MUTEX-NAME

Plaintext Payload

curl -X POST -d 'MUTEX-NAME' http://localhost:3000/unlockPlaintextBody

JSON Payload

curl -X POST -d '{"key":"MUTEX-NAME"}' http://localhost:3000/unlockJSONBody

Response

When the lock has been activated, the http body will match locked.

When the lock has been deactivated, the http body will match unlocked.

Until activation or deactivation occurs, it will wait - so ensure your timeouts are set accordingly for your workload.