Hello, I'm trying to create a wrapper around a JSON Rest service. I can query the service. It responds with a JSON message with the following form {"cursor" : "some id", "remaining": true, "data" : [list of documents]}. If the remaining flag is true, another API call to the cursor resource is made, getting the same data structure back. The process repeats until either the whole cursor is read and auto-deleted by the server, or until someone DELETEs the cursor if they don't want the rest.
It's possible for a result to be several GB in total size. I don't want to eagerly load the data. I was thinking doing something like the JDBC lazy read. I'm just not sure how to do this (I've only been working with Clojure for about 2 weeks). I thought a protocol might work: (defprotocol (execute [query]) (close []). I run into any issue with a protocol having aritty of zero. I'm a bit stumped at this point. I think that lazy-seq is the way to go given the most application interactions with the list of data is really read forward only, working with head in-place at the time of generating a view. This should reduce application overhead. It would implement the lazy-seq to delete the cursor behind the scenes with the whole list was read. My worry is what happens if (take 2) or the like occurs off of a collection of 100s? The server will eventually delete the cursor, but I don't want to waste what few server resources I have on storing that information. I hope this make sense. Thanks for the help. JPD -- 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.