mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat(nbstore): add blob sync storage (#10752)
This commit is contained in:
@@ -137,5 +137,16 @@ export interface NbStorePlugin {
|
||||
docId: string;
|
||||
timestamp: number;
|
||||
}) => Promise<void>;
|
||||
getBlobUploadedAt: (options: {
|
||||
id: string;
|
||||
peer: string;
|
||||
blobId: string;
|
||||
}) => Promise<{ uploadedAt: number | null }>;
|
||||
setBlobUploadedAt: (options: {
|
||||
id: string;
|
||||
peer: string;
|
||||
blobId: string;
|
||||
uploadedAt: number | null;
|
||||
}) => Promise<void>;
|
||||
clearClocks: (options: { id: string }) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -311,4 +311,29 @@ export const NbStoreNativeDBApis: NativeDBApis = {
|
||||
id,
|
||||
});
|
||||
},
|
||||
getBlobUploadedAt: async function (
|
||||
id: string,
|
||||
peer: string,
|
||||
blobId: string
|
||||
): Promise<Date | null> {
|
||||
const result = await NbStore.getBlobUploadedAt({
|
||||
id,
|
||||
peer,
|
||||
blobId,
|
||||
});
|
||||
return result.uploadedAt ? new Date(result.uploadedAt) : null;
|
||||
},
|
||||
setBlobUploadedAt: async function (
|
||||
id: string,
|
||||
peer: string,
|
||||
blobId: string,
|
||||
uploadedAt: Date | null
|
||||
): Promise<void> {
|
||||
await NbStore.setBlobUploadedAt({
|
||||
id,
|
||||
peer,
|
||||
blobId,
|
||||
uploadedAt: uploadedAt ? uploadedAt.getTime() : null,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user