feat(multipart): Implement full multipart upload support with persistent manager, periodic cleanup, and API integration

This commit is contained in:
2025-11-23 23:31:26 +00:00
parent d6f178bde6
commit 648ff98c2d
6 changed files with 287 additions and 4 deletions

View File

@@ -78,11 +78,19 @@ export class Smarts3Server {
maxMetadataSize: 2048,
requestTimeout: 300000,
},
multipart: {
expirationDays: 7,
cleanupIntervalMinutes: 60,
},
};
this.logger = new Logger(this.config.logging);
this.store = new FilesystemStore(this.options.directory);
this.multipart = new MultipartUploadManager(this.options.directory);
this.multipart = new MultipartUploadManager(
this.options.directory,
this.config.multipart.expirationDays,
this.config.multipart.cleanupIntervalMinutes
);
this.router = new S3Router();
this.middlewares = new MiddlewareStack();
@@ -297,6 +305,9 @@ export class Smarts3Server {
// Initialize multipart upload manager
await this.multipart.initialize();
// Start multipart cleanup task
this.multipart.startCleanupTask();
// Clean slate if requested
if (this.options.cleanSlate) {
await this.store.reset();
@@ -337,6 +348,9 @@ export class Smarts3Server {
return;
}
// Stop multipart cleanup task
this.multipart.stopCleanupTask();
await new Promise<void>((resolve, reject) => {
this.httpServer!.close((err?: Error) => {
if (err) {