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 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
/// <summary>
/// Gets the file path being uploaded.
/// </summary>
public string FilePath { get; private set; }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i put this here for consistency with the UploadProgress. i think technically its part of the Request (Request.FilePath). im open to removing this though

… upload

stack-info: PR: #4059, branch: GarrettBeatty/stacked/1
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.

1 participant