fix(server): avoid get object content when syncing (#9402)

This commit is contained in:
liuyi
2024-12-28 00:25:15 +08:00
committed by GitHub
parent 6ebefbbf2b
commit 378db1054b
5 changed files with 75 additions and 37 deletions

View File

@@ -24,6 +24,10 @@ export interface WorkspaceEvents {
workspaceId: Workspace['id'];
key: string;
}>;
sync: Payload<{
workspaceId: Workspace['id'];
key: string;
}>;
};
}

View File

@@ -61,6 +61,15 @@ export class FsStorageProvider implements StorageProvider {
this.logger.verbose(`Object \`${key}\` put`);
}
async head(key: string) {
const metadata = this.readMetadata(key);
if (!metadata) {
this.logger.verbose(`Object \`${key}\` not found`);
return undefined;
}
return metadata;
}
async get(key: string): Promise<{
body?: Readable;
metadata?: GetObjectMetadata;

View File

@@ -34,6 +34,7 @@ export interface StorageProvider {
body: BlobInputType,
metadata?: PutObjectMetadata
): Promise<void>;
head(key: string): Promise<GetObjectMetadata | undefined>;
get(
key: string
): Promise<{ body?: BlobOutputType; metadata?: GetObjectMetadata }>;