// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. import type { ITerminal } from '@rushstack/terminal'; /** * @beta */ export interface ICloudBuildCacheProvider { readonly isCacheWriteAllowed: boolean; tryGetCacheEntryBufferByIdAsync(terminal: ITerminal, cacheId: string): Promise; trySetCacheEntryBufferAsync(terminal: ITerminal, cacheId: string, entryBuffer: Buffer): Promise; /** * If implemented, the build cache will prefer to use this method over * {@link ICloudBuildCacheProvider.tryGetCacheEntryBufferByIdAsync} to avoid loading the entire * cache entry into memory, if possible. The implementation should download the cache entry and write it * to the specified local file path. * * @returns `true` if the cache entry was found and written to the file; otherwise `false`. * Implementations typically log transfer failures and return `false`, but may still throw for * unexpected errors. */ tryDownloadCacheEntryToFileAsync?( terminal: ITerminal, cacheId: string, localFilePath: string ): Promise; /** * If implemented, the build cache will prefer to use this method over * {@link ICloudBuildCacheProvider.trySetCacheEntryBufferAsync} to avoid loading the entire * cache entry into memory, if possible. The implementation should read the cache entry from * the specified local file path and upload it. * * @returns `true` if the cache entry was written to the cache, otherwise `false`. */ tryUploadCacheEntryFromFileAsync?( terminal: ITerminal, cacheId: string, localFilePath: string ): Promise; updateCachedCredentialAsync(terminal: ITerminal, credential: string): Promise; updateCachedCredentialInteractiveAsync(terminal: ITerminal): Promise; deleteCachedCredentialsAsync(terminal: ITerminal): Promise; }