nathanmarz/storm — pull request #94 by schleyfox (2012-01-09 19:07:36+00:00)
Title: Clojure tuples

These commits address #25 and add some improved semantics to the Clojure DSL.

Stream/component/task info on a tuple is now accessible from the meta data.

Tuples now implement ILookup, IPersistentMap, Indexed, Seqable, IFn, and Map so that things like (nth tuple 1), (tuple :foo-field), (:foo-field tuple), etc. work.

Added an IndifferentAccessMap to allow tuple field names to be treated as either keywords or strings.

Tuples can now be "modified" like clojure maps with assoc/dissoc. This is useful for building up values to emit. This is kind of a naive implementation, but I think it works pretty well for the task at hand.

From the Clojure side, emit-bolt!/emit-bolt-direct! can now take its values as either a list or a map. If it is provided a map, then it will find the output fields for the stream and construct the values list from the map based on that (currently null for any fields not present in the map, which I think is sensible). We've been using a pattern like this on our project at NabeWise and I find it to be very powerful/convenient.

I apologize in advance that my java-fu is somewhat weak, so let me know if I need to fix any style or other issues.