FAQ
Background: I'm a golang novice and I'm writing a graph-search algorithm (it's basically "ambiguous dependency resolution" similar to what apt-get does). I want to make it concurrent, partly for fun, and partly to leverage multiple cpu cores (and, perhaps one day, multiple machines). I have a plan that involves many goroutines scurrying around the graph, and I want them to avoid duplicating each others' work.

Observation: I think I want a "duplicate function call suppression mechanism" very similar to groupcache/singleflight, but with one change. My "Getter" is not an expensive operation to deliver a valuable/reusable payload, like a flight. Rather it is like a train: an expensive operation to deliver a list of results, which may trickle in one at a time. When callers are blocked on the computation, I want them to receive the results ("traincars") as they come in, rather than waiting for the end of the computation. I think I see how to write this, but first...

Questions:
1. Am I dumb for thinking I want this?
2. If not, does something like this exist already?
3. If not, and I write it, would someone be willing to review it?
4. If I do write it, would it be so generally-useful that I should use interface{} and casting, or should I just enjoy the safety of my own bespoke types?

Thanks,
--Adam Bliss

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ingo Oeser at Nov 29, 2013 at 9:40 pm
    Just let the first of them succeeding start the actual work and send it's
    results off a new channel.
    The others get all the results as copies via fanout patterns like
    http://stackoverflow.com/questions/16930251/go-one-producer-many-consumers

    But there might be much better ideas.
    On Friday, November 29, 2013 9:28:33 AM UTC+1, abl...@gmail.com wrote:

    Background: I'm a golang novice and I'm writing a graph-search algorithm
    (it's basically "ambiguous dependency resolution" similar to what apt-get
    does). I want to make it concurrent, partly for fun, and partly to leverage
    multiple cpu cores (and, perhaps one day, multiple machines). I have a plan
    that involves many goroutines scurrying around the graph, and I want them
    to avoid duplicating each others' work.

    Observation: I think I want a "duplicate function call suppression
    mechanism" very similar to groupcache/singleflight, but with one change. My
    "Getter" is not an expensive operation to deliver a valuable/reusable
    payload, like a flight. Rather it is like a train: an expensive operation
    to deliver a list of results, which may trickle in one at a time. When
    callers are blocked on the computation, I want them to receive the results
    ("traincars") as they come in, rather than waiting for the end of the
    computation. I think I see how to write this, but first...

    Questions:
    1. Am I dumb for thinking I want this?
    2. If not, does something like this exist already?
    3. If not, and I write it, would someone be willing to review it?
    4. If I do write it, would it be so generally-useful that I should use
    interface{} and casting, or should I just enjoy the safety of my own
    bespoke types?

    Thanks,
    --Adam Bliss
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 29, '13 at 6:48p
activeNov 29, '13 at 9:40p
posts2
users2
websitegolang.org

2 users in discussion

Ingo Oeser: 1 post Abliss: 1 post

People

Translate

site design / logo © 2022 Grokbase