Skip to content

[Core] Wiring up rehydration token logic in data-plane #49224

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kinelski
Copy link
Member

@kinelski kinelski commented Apr 3, 2025

Currently DPG libraries do not support rehydrating long-running operations. This means that, after a long-running operation has been started, users must hold their Operation<T> reference until its completion in order to access its final result. This can be a problem as some operations could take hours or even days to complete.

Our TypeSpec code generator already supports the creation of rehydration tokens to retrieve the status of long-running operations, but the logic to do so had not been wired into our Operation API yet.

Fixes #48594.

@kinelski kinelski added Client This issue points to a problem in the data-plane of the library. Azure.Core labels Apr 3, 2025
@kinelski kinelski self-assigned this Apr 3, 2025
Comment on lines +34 to +42
public override RehydrationToken? GetRehydrationToken()
{
if (_nextLinkOperation is NextLinkOperationImplementation nextLinkOperation)
{
return nextLinkOperation?.GetRehydrationToken();
}

return null;
}
Copy link
Member Author

@kinelski kinelski Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supposedly _nextLinkOperation will always be a NextLinkOperationImplementation instance in data-plane. I didn't want to force a cast here to avoid throwing in unpredicted scenarios. Before this change, GetRehydrationToken would always return null anyway.

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@kinelski kinelski marked this pull request as ready for review April 3, 2025 18:55
@kinelski kinelski requested a review from a team as a code owner April 3, 2025 18:55
@kinelski kinelski requested a review from m-nash April 3, 2025 19:02
Copy link
Member

@jsquire jsquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, but I'll ask that @JoshLove-msft and @m-nash be the authoritative approvals here, as there are generator and management plane implications.

@kinelski kinelski requested a review from JoshLove-msft April 4, 2025 21:42
@@ -30,6 +30,17 @@ internal ProtocolOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pip
public override string Id => throw new NotSupportedException();
#pragma warning restore CA1822

/// <inheritdoc />
public override RehydrationToken? GetRehydrationToken()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be added to the OperationState so that all operation types pick up the new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] Data-plane: enable LRO rehydration
4 participants