[
https://issues.apache.org/jira/browse/STORM-1246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15148660#comment-15148660
]
Robert Joseph Evans commented on STORM-1246:
--------------------------------------------
The issue is that local_state.clj is providing two different things. The first
is conversions between thrift data structures and clojure maps. The second a
set of functions that make working with a LocalState instance simpler (they
know the type of the data structures that should be used). The first part we
don't need/want when this is all done. There is no reason to go to clojure
when we don't use clojure any more. The second could be wrapped into
LocalState itself. I would suggest that you move/rename the -> functions to
converter.clj, and then inline the separation. So for example
{code}
;TODO: when translating this function, you should replace the map-val with a
proper for loop HERE
(defn ls-local-assignments
[^LocalState local-state]
(if-let [thrift-local-assignments (.get local-state LS-LOCAL-ASSIGNMENTS)]
(map-val
->local-assignment
(.get_assignments thrift-local-assignments))))
{code}
would become something like
LocalState.java
{code}
public Map<Long, LocalAssignment> getLocalAssignments() {
//TODO needs null checks
return ((LSSupervisorAssignments)get(LOCAL_ASSIGNMENTS)).get_assignments();
}
{code}
converter.clj
{code}
;;needs a better name
(defn ->local-assignments
[thrift-local-assignments]
(if thrift-local-assignments
(map-val
->local-assignment
(.get_assignments thrift-local-assignments))))
{code}
Then everywhere that ls-local-assignments is called would be replaced with
{code}
(->local-assignments (.getLocalAssignments local-state))
{code}
When that code is translated into java they can use the thrift APIs directly.
> port backtype.storm.local-state to java
> ---------------------------------------
>
> Key: STORM-1246
> URL: https://issues.apache.org/jira/browse/STORM-1246
> Project: Apache Storm
> Issue Type: New Feature
> Components: storm-core
> Reporter: Robert Joseph Evans
> Assignee: Abhishek Agarwal
> Labels: java-migration, jstorm-merger
>
> Wrapper around LocalState, with some helper functions for converting between
> storm and thrift.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)