Skip to content

Conversation

@GarrettBeatty
Copy link
Contributor

@GarrettBeatty GarrettBeatty commented Oct 18, 2025

Stacked PRs:


Description

This change adds progress listeners for "initiated", "complete", and "failed" lifecycle events for the SimpleUploadCommand (non multipart). Consumers can subscribe to these callbacks to receive notifications when a simple upload starts, finishes successfully, or fails. We will also make this change for multi part upload command here #4061

Example usage

// Create a TransferUtilityUploadRequest
TransferUtilityUploadRequest request = new TransferUtilityUploadRequest();

// Subscribe to the progress events
request.UploadInitiatedEvent += Request_UploadInitiatedEvent;
request.UploadCompletedEvent += Request_UploadCompletedEvent;
request.UploadFailedEvent += Request_UploadFailedEvent;

// Use the Transfer Utility to upload the file
using (var transferUtility = new TransferUtility(s3Client))
{
    transferUtility.UploadAsync(request);
}

private void Request_UploadInitiatedEvent(object sender, UploadInitiatedEventArgs e)
{
    Console.WriteLine($"Upload initiated for file: {e.FilePath}");
    Console.WriteLine($"Total bytes to transfer: {e.TotalBytes}");
}

private void Request_UploadCompletedEvent(object sender, UploadCompletedEventArgs e)
{
    Console.WriteLine($"Upload completed for file: {e.FilePath}");
    Console.WriteLine($"Transferred bytes: {e.TransferredBytes}");
    Console.WriteLine($"ETag: {e.Response.ETag}");
    Console.WriteLine($"Version ID: {e.Response.VersionId}");
}

private void Request_UploadFailedEvent(object sender, UploadFailedEventArgs e)
{
    Console.WriteLine($"Upload failed for file: {e.FilePath}");
    Console.WriteLine($"Transferred bytes: {e.TransferredBytes} / {e.TotalBytes}");
}


Motivation and Context

  1. To adhere to the SEP

Testing

  1. 46a4bf17-39fd-41e9-b625-1fba1b49f5a4 - pass
  2. Integration tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds lifecycle event notifications (initiated, completed, and failed) for simple uploads in the AWS S3 Transfer Utility. The implementation provides developers with more granular visibility into upload operations beyond just progress tracking.

Key changes:

  • Added three new event types: UploadInitiatedEvent, UploadCompletedEvent, and UploadFailedEvent to TransferUtilityUploadRequest
  • Enhanced SimpleUploadCommand to fire these events at appropriate lifecycle stages
  • Added comprehensive test coverage for all new event scenarios

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
TransferUtilityUploadRequest.cs Added three new event handlers and corresponding event argument classes with detailed documentation
SimpleUploadCommand.cs Enhanced with lifecycle event firing methods and improved progress tracking with thread-safe counters
SimpleUploadCommand.async.cs Updated async execution flow to fire lifecycle events at appropriate points
TransferUtilityTests.cs Added comprehensive test coverage for all lifecycle events including failure scenarios
433a9a6d-b8ea-4676-b763-70711e8288e2.json Added dev config file marking this as a minor version change

@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch from fa2c582 to a77093f Compare October 18, 2025 15:42
@GarrettBeatty GarrettBeatty mentioned this pull request Oct 18, 2025
10 tasks
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch 3 times, most recently from fc6fc58 to d01f5ab Compare October 20, 2025 13:38
@GarrettBeatty GarrettBeatty marked this pull request as ready for review October 20, 2025 13:41
@GarrettBeatty GarrettBeatty force-pushed the gcbeatty/tuuploadresponse branch from 4f9bdfa to 2684d9d Compare October 20, 2025 14:03
Base automatically changed from gcbeatty/tuuploadresponse to feature/transfermanager October 20, 2025 14:03
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch from d01f5ab to d58e4d8 Compare October 20, 2025 14:06
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch from 6fd0aea to a453991 Compare October 21, 2025 20:51
@aws aws deleted a comment from peterrsongg Oct 21, 2025
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch from a453991 to 9e75ff2 Compare October 22, 2025 16:36
usesHeadersCollection: false,
(sourceRequest) =>
{
sourceRequest.InputStream = new MemoryStream(1024);
Copy link
Contributor Author

@GarrettBeatty GarrettBeatty Oct 22, 2025

Choose a reason for hiding this comment

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

was getting null pointer on content length without this change. in reality, input stream or file path will always be set so users shouldnt get null pointer

@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch from 9e75ff2 to 04a8101 Compare October 23, 2025 01:27
… upload

stack-info: PR: #4059, branch: GarrettBeatty/stacked/1
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/1 branch from 04a8101 to 4f92152 Compare October 23, 2025 16:02
@GarrettBeatty GarrettBeatty merged commit 36f083b into feature/transfermanager Oct 23, 2025
1 check passed
@GarrettBeatty GarrettBeatty deleted the GarrettBeatty/stacked/1 branch October 23, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants