Hi,

I’m new to Clojure async operations (while have a good understanding of 
other things) and want to get a bit of advice. Atoms & agents still confuse 
me.

What I’m implementing is a small REST webservice with custom in-memory 
database. Database is indexed by unique key, basically it’s a map (I’ll 
denote it as MAP). There are two basic operations:

*PUT /api/…/<KEY>.* Initiate an update for given KEY. The HTTP response 
should be returned immediately, and the processing should be done 
asynchronously. The processing consists of downloading a data file from web 
and doing some data crunching, the result should go into MAP.

*GET /api/…/<KEY>.* Use (get MAP KEY) and request params to generate 
response synchronously.

The tricky part (well, for me :) is that parallel PUT requests should be 
possible. The downloading and processing can and should go in parallel, 
independently, whereas updating the MAP should come synchronized, 
one-after-the-other.

How would you implement this?

--
Oleg.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to