-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeferredOutput<T> #385
DeferredOutput<T> #385
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to start using in C# program-gen, unless there are things we are uncertain about yet?
Yeh let me fill in docs then we can probably merge this. |
Are we settled on the API design and naming for this? What's it going to look like in the other SDKs? |
Will be discussing next week but leaning towards a unified name |
a3c94e8
to
bda6049
Compare
d0941a6
to
b647f31
Compare
This PR has been shipped in release v3.69.0. |
Adds
DeferredOutput<T>
that allows the creation of anOutput<T>
that can later be resolved to the final result of a differentOutput<T>
.This can be used to solve partial circular reference problems. For example given two components that create multiple resources and return some results from that, you would normally have to have all the inputs for one component available to call it and then afterwards call the other component. With an
DeferredOutput<T>
you can instead set up a circular reference:As long as
MakeComponentA
can resolve its A1 result without needing the incoming output resolved then the above will work.Note that it's possible to deadlock the program with this feature. If resultA1 above can't resolve until the input is resolved, and resultB can't resolve till its input is resolved then both will end up stuck waiting for the other. Users can already deadlock their programs with other dotnet constructs (for example doing a similar thing with
TaskCompletionSource<T>
).