Rework the interface for session task to get result from registered upload#690
Merged
Rework the interface for session task to get result from registered upload#690
Conversation
assafvayner
approved these changes
Mar 11, 2026
xet_pkg/examples/example.rs
Outdated
| // Enqueue all uploads; each starts immediately in the background. | ||
| let n_files = files.len(); | ||
| let handles: Vec<TaskHandle> = files | ||
| let handles: Vec<_> = files |
Contributor
There was a problem hiding this comment.
for the sake of examples, can we avoid omitting types, this makes me have to go to the code to figure out all the return types I need to use, making the example less useful (still useful, but more useful with no explicit type omissions.
Collaborator
Author
There was a problem hiding this comment.
Yes for sure! Inserted types
hoytak
approved these changes
Mar 11, 2026
Collaborator
hoytak
left a comment
There was a problem hiding this comment.
LGTM. Some minor thoughts, but I think we should get this in and then iterate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the interface for retrieving per-task results after UploadCommit::commit() or DownloadGroup::finish(). The problem with the previous interface is that commit() and finish() return a vector of FileMetadata or DownloadResult, making it difficult for users to associate each result with a specific task.
The new interface uses
task_idas a strong binding bridge:Upload per-task result access patterns
After commit() completes, there are two equivalent ways to retrieve a per-task FileMetadata result:
Download per-task result access patterns
The pattern is similar to the above.
Why not put results in a vector in the same order as tasks are registered to the commit instance?
After a commit instance is created, it can be cloned (since it is itself an Arc wrapping an internal struct) and sent to different threads. When multiple threads are registering tasks, there is no static registration order that a program can observe upfront.
Fix XET-890