Some questions on lifecycles / onyx-starter project

50 views
Skip to first unread message

Harshad Saykhedkar

unread,
Dec 11, 2015, 5:14:53 AM12/11/15
to Onyx
Hi,

First of all thank you for the awesome work. The project looks very interesting. The effort put into documentation is really laudable.

I just started playing around with Onyx through onyx-starter project. I have few (noob) questions, especially on life cycles. I was hoping someone will help me confirm if my understanding is correct.
  1. In sample_lifecycles.clj line 18-21, the get-input-channel is memoized (with a comment above it on reference). Does the memorization ensure that (reference to the) same core.async channel gets returned on each call?
  2. In sample_lifecycles.clj, the build-lifecycles function returns vector of maps. Does the same map get passed as the lifecycle argument to the inject-in-ch function? Or in other words, is this a contract that each map for lifecycle will get passed to the corresponding functions called by the calls?
Thanks again!

Harshad

Mike Drogalis

unread,
Dec 11, 2015, 11:38:30 AM12/11/15
to Harshad Saykhedkar, Onyx
Hi Harshad,

On Fri, Dec 11, 2015 at 2:14 AM, Harshad Saykhedkar <harsh...@gmail.com> wrote:
Hi,

First of all thank you for the awesome work. The project looks very interesting. The effort put into documentation is really laudable.

I just started playing around with Onyx through onyx-starter project. I have few (noob) questions, especially on life cycles. I was hoping someone will help me confirm if my understanding is correct.
  1. In sample_lifecycles.clj line 18-21, the get-input-channel is memoized (with a comment above it on reference). Does the memorization ensure that (reference to the) same core.async channel gets returned on each call?
That's exactly right. Multiple threads need to use the channel without explicitly sharing a global reference, so we use a common identifier conveyed through the lifecycle to pick out the channel from the implicit memoized atom. This is a bit of a development trick to make using channels easier for local work.
  1. In sample_lifecycles.clj, the build-lifecycles function returns vector of maps. Does the same map get passed as the lifecycle argument to the inject-in-ch function? Or in other words, is this a contract that each map for lifecycle will get passed to the corresponding functions called by the calls?
Your understanding here is correct also, that's how it works. It ends up being useful to add runtime parameters to that map so you can access them inside the concrete functions that they're bound to.

Thanks again!

Harshad

--
You received this message because you are subscribed to the Google Groups "Onyx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onyx-user+...@googlegroups.com.
To post to this group, send email to onyx...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/onyx-user/9ceff4c0-5c1f-4046-a11a-a9769c40599d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages