Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
/ resm Public archive

Simple resource manager that provides resources on demand

License

Notifications You must be signed in to change notification settings

hiend/resm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resm - Resource manager.

Authors: Averbakh Dmitry ([email protected]).

Resm is a simple resource manager with REST API interface and JSON data format

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.

Let's get started

Requirements

Erlang R16 or higher.

Installation

From sources

Clone the repository:

git clone [email protected]:hiend/resm.git

Build:

make

Run

Production:

make console

Development:

make dev-rel console

From deb package (debian based linux, e.g. ubuntu)

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

From docker image

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.


REST API

1. Allocate

RETURNS:
    201, r1
    503, Out of resources

2. Deallocate

RETURNS:
    204
    404, Not allocated

3. List

GET /list

RETURNS:
    200, {"allocated":[],"deallocated":["r1","r2"]}
    200, {"allocated":{"r1":"user"},"deallocated":["r2"]}

4. User list

RETURNS:
    200, []
    200, ["r1","r2"]

5. Reset

GET /reset

RETURNS:
    204

Modules

resm
resm_manager
resm_rest
resm_sup

About

Simple resource manager that provides resources on demand

Resources

License

Stars

Watchers

Forks

Packages

No packages published