mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Add SeaweedFS-backed file storage infrastructure
Introduces IFileStorageProvider and an S3-compatible implementation (S3FileStorageProvider) configured via new SEAWEEDFS_* configuration keys, for storing uploaded files against SeaweedFS.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
namespace Infrastructure.FileUpload;
|
||||
|
||||
/// <summary>
|
||||
/// Service for storing and retrieving uploaded files in S3-compatible object storage.
|
||||
/// </summary>
|
||||
public interface IFileStorageProvider
|
||||
{
|
||||
/// <summary>Uploads a file to the configured bucket.</summary>
|
||||
/// <param name="key">The object key (path) to store the file under.</param>
|
||||
/// <param name="content">The file content.</param>
|
||||
/// <param name="contentType">The MIME type of the file.</param>
|
||||
/// <param name="cancellationToken">A token to cancel the upload.</param>
|
||||
Task UploadAsync(
|
||||
string key,
|
||||
Stream content,
|
||||
string contentType,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>Deletes a file from the configured bucket.</summary>
|
||||
/// <param name="key">The object key of the file to delete.</param>
|
||||
/// <param name="cancellationToken">A token to cancel the deletion.</param>
|
||||
Task DeleteAsync(string key, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Generates a time-limited URL for retrieving a file directly from storage.</summary>
|
||||
/// <param name="key">The object key of the file.</param>
|
||||
/// <param name="expiresIn">How long the URL remains valid.</param>
|
||||
string GetPresignedUrl(string key, TimeSpan expiresIn);
|
||||
}
|
||||
Reference in New Issue
Block a user