Add streaming APIs to build cache provider interface and all cache plugins#5746
Add streaming APIs to build cache provider interface and all cache plugins#5746
Conversation
…P plugin Add optional tryGetCacheEntryStreamByIdAsync and trySetCacheEntryStreamAsync methods to ICloudBuildCacheProvider. Implement streaming in HttpBuildCacheProvider and update OperationBuildCache to prefer streaming when available. Add fetchStreamAsync to WebClient and stream write support to FileSystemBuildCacheProvider. Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/050e10a7-3cad-4da4-93e5-9941453283b9 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/050e10a7-3cad-4da4-93e5-9941453283b9 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/050e10a7-3cad-4da4-93e5-9941453283b9 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
…file Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/798065bf-040f-462e-8ea9-b9ca5659196d Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
|
@copilot - add APIs to |
…rary and update consumers to use FileSystem instead of fs directly Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/5ad20d4d-c9a4-4855-bb13-8dd9e2c1350b Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Added |
|
@copilot - are there async variants of those |
No, |
|
@copilot - take a look at the other |
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/199d4b3e-1f3f-44e1-9fc6-7b4a0e027c7e Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Added |
|
@copilot - can we add stream support to the other cache plugins? |
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/6212baeb-266c-4823-94df-251c69a8f74c Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
…y streaming upload Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/6212baeb-266c-4823-94df-251c69a8f74c Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Added streaming support to both remaining cache plugins: Amazon S3 plugin (
Azure Storage plugin (
All three cache plugins (HTTP, S3, Azure) now implement both streaming methods. All existing tests pass (45 S3, 10 Azure). |
|
@copilot - Can you put usage of this functionality behind a Rush experiment? |
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/63fb5abe-e500-4a9c-bd82-3ed613989ef4 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Added a |
...rushstack/node-core-library/copilot-stream-cache-entry-for-http-plugin_2026-04-05-04-27.json
Outdated
Show resolved
Hide resolved
common/changes/@microsoft/rush/copilot-stream-cache-entry-for-http-plugin_2026-04-05-03-56.json
Outdated
Show resolved
Hide resolved
Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
| * Makes an HTTP request that resolves as soon as headers are received, providing the | ||
| * response body as a readable stream. This avoids buffering the entire response in memory. | ||
| */ | ||
| const makeStreamRequestAsync: StreamFetchFn = async ( |
There was a problem hiding this comment.
@copilot - This function should be able to be DRY'd up with makeRequestAsync.
There was a problem hiding this comment.
Extracted shared _makeRawRequestAsync function that handles URL parsing, protocol selection, redirect following, body sending, and error handling. makeRequestAsync and makeStreamRequestAsync now both delegate to this shared core, each providing only their response-handling callback. Commit: a5dfa47
| * does not use retry logic because the stream is consumed after the first attempt and cannot be | ||
| * replayed. The caller should handle failures accordingly. | ||
| */ | ||
| public async uploadObjectStreamAsync(objectName: string, objectStream: Readable): Promise<void> { |
There was a problem hiding this comment.
@copilot - This should be able to be DRY'd up with uploadObjectStreamAsync.
There was a problem hiding this comment.
uploadObjectAsync and uploadObjectStreamAsync now both use the shared _makeSignedRequestAsync method. The upload methods still differ in retry behavior (buffer retries, stream doesn't), so they remain as separate public methods. Commit: a5dfa47
…lient private member type mismatch Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/1b32730c-9ce0-4e75-a2e1-45f06a628960 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
…dCacheProvider Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/c103fb17-b8b1-4d02-88ba-9db236e9f48f Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Addressed all duplication instances across the three files:
Net result: -4 lines (337 added, 341 removed). Commit: a5dfa47 |
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/c103fb17-b8b1-4d02-88ba-9db236e9f48f Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
IFileSystemCreateWriteStreamOptionswithensureFolderExistsoptionuseStreamingBuildCacheexperiment flagmakeStreamRequestAsyncwithmakeRequestAsyncin WebClient.ts via shared_makeRawRequestAsyncgetObjectStreamAsyncwithgetObjectAsyncin AmazonS3Client.ts via shared_handleGetResponseAsync_makeStreamRequestAsyncwith_makeRequestAsyncinto_makeSignedRequestAsyncin AmazonS3Client.ts_makeHttpStreamRequestAsyncwith_makeHttpRequestAsyncvia shared_makeHttpCoreRequestAsyncin HttpBuildCacheProvider.ts