Authors: Averbakh Dmitry ([email protected]
).
Manager operate with limited resources count, specified in a configuration or environment variables. Resource is a unique rN kind id. Manager provide five operations for resources manipulation: allocate resources for user, deallocate resources, show list of allocated and deallocated resources, show list resources allocated by user and reset allocated resources state.
Resource allocating by username and associated with him up to deallocation. List of allocated resources stored like a tuple list, i.e. [{resource, user}], deallocated resources stored like a simple list. Resource deallocating performed by his unique id. Resources list associated with user you may get by his name.
Erlang R16 or higher.
Clone the repository:
git clone [email protected]:hiend/resm.git
Build:
make
Production:
make console
Development:
make dev-rel console
Download:
wget https://github.com/hiend/resm/releases/download/1.0.1/resm_1.0.1_amd64.deb
Install:
sudo dpkg -i resm_1.0.1_amd64.deb
Run:
sudo service resm start
Pull image:
docker pull hiend/resm:1.0.1
Run:
docker run -dit -p 8008:8008 hiend/resm:1.0.1
Go to http://localhost:8008/list
and check that works!
Stop the running application by typing halt().
into the REPL console.
GET /allocate/user
RETURNS:
201, r1
503, Out of resources
GET /deallocate/r1
RETURNS:
204
404, Not allocated
GET /list
RETURNS:
200, {"allocated":[],"deallocated":["r1","r2"]}
200, {"allocated":{"r1":"user"},"deallocated":["r2"]}
GET /list/user
RETURNS:
200, []
200, ["r1","r2"]
GET /reset
RETURNS:
204
resm |
resm_manager |
resm_rest |
resm_sup |