From c70778a52e1e654f89970aad21b60e1f939818dd Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Tue, 20 Feb 2018 21:33:45 -0300 Subject: README --- README.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 46866b8..f171e30 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,73 @@ # queue-api -generated using Luminus version "2.9.12.25" +A simple job queue api -FIXME +## Usage -## Prerequisites +To run just type -You will need [Leiningen][1] 2.0 or above installed. +`lein run` -[1]: https://github.com/technomancy/leiningen +then access [localhost:3000/swagger-ui](http://localhost:3000/swagger-ui/index.html). -## Running +## Stack -To start a web server for the application, run: +I chose [luminus](http://www.luminusweb.net/) for my stack as it made the initial setup way easier since it provide a wide range option of configuration for a lot of technologies. +To bootstrap the project I used `lein new luminus queue-api +swagger +service +kibit` plus datascrypt, which by default doesn't come with Luminus. - lein run +### +Swagger -## License +When possible I always add it to a project for it make easier to visualize and test endpoints. -Copyright © 2018 FIXME +### +Service + +To remove all front end stuff since I didn't need it. + +### +Kibit + +I added because it gives some insight how to make you code more idiomatic. + +### Datascript + +I chose [datascript](https://github.com/tonsky/datascript) for its easy setup, after little to no effort I had it working. +Even though it was meant to run on browser it fit nicely in the project, and because it works pretty much like Datomic it has [powerful query system](https://docs.datomic.com/on-prem/query.html) and works seamlessly with clojure. +Additionally it had an okay [non-documentation](https://github.com/tonsky/datascript/wiki/Getting-started) with some [samples](https://github.com/kristianmandrup/datascript-tutorial) and if I couldn't find for Datascript I would search for a Datomic seeing that query system of both are compatible. + +## Solution + +### Data structure + +Project has two model: + +* Agent + * `:agent/id` unique identification of an agent + * `:agent/name` agent name + * `:agent/primary-skillset`: list of primary skillsets of an agent + * `:agent/secondary-skillset` list of secondary skillsets of an agent + * `:agent/job` reference to job that the agent is processing +* Job + * `:job/id` unique identification of a job + * `:job/status` current status of the job it can be: + * `:unassigned` it is waiting to be assigned + * `:processing` it is being precessed by an agent + * `:completed` it has been done with. + * `:job/agent` reference a job that is processing this job or had processed it. it is nil when `:unassigned` + * `:job/type` type of the job that it can perform + +Those models wrap up in schema: + +```clojure +{:agent/id {:db/unique :db.unique/identity} + :agent/primary-skillset {:db/cardinality :db.cardinality/many} + :agent/secondary-skillset {:db/cardinality :db.cardinality/many} + :agent/job {:db.valueType :db.type/ref} + :job/id {:db/unique :db.unique/identity} + :job/agent {:db.valueType :db.type/ref}} +``` + + + + + + + -- cgit v1.2.3