You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some backend servers act as API aggregators with many external dependencies downstream. The order in which dependencies are called is not always simple, for example some could be called in parallel using goroutines, some others might need to wait for one or more dependencies to complete before they can run, etc. For a large application this can be hard to maintain. Such problem can be modelled with a DAG and the order in which external services are called defined by topologically sorting the graph.
Wire implements a large part of the above, except the code emitted is designed for synchronous execution. Essentially what I wanted is for Wire to do the following,
I was wondering if this has come up in the past and thoughts on merging this kind of functionality upstream?
PS. Initally I implemented a reflection based solution using https://github.com/twitter/nodes API as a guide, but I really wanted compile time safety and realised Wire did a lot of what I needed already.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Some backend servers act as API aggregators with many external dependencies downstream. The order in which dependencies are called is not always simple, for example some could be called in parallel using goroutines, some others might need to wait for one or more dependencies to complete before they can run, etc. For a large application this can be hard to maintain. Such problem can be modelled with a DAG and the order in which external services are called defined by topologically sorting the graph.
Wire implements a large part of the above, except the code emitted is designed for synchronous execution. Essentially what I wanted is for Wire to do the following,
where the emitted code is,
Granted this example doesn't really shine but imagine for large complex aggregations this can be really useful.
I actually went ahead and tried implementing it, with some nice results: https://github.com/deliveroo/async-wire
I was wondering if this has come up in the past and thoughts on merging this kind of functionality upstream?
PS. Initally I implemented a reflection based solution using https://github.com/twitter/nodes API as a guide, but I really wanted compile time safety and realised Wire did a lot of what I needed already.
Beta Was this translation helpful? Give feedback.
All reactions