mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-02 22:59:56 +08:00
feat(nbstore): init (#7639)
TODO - [x] basic - [x] storages - [x] producer/consumer - [x] operation pattern - [x] events - [x] worker - [x] readme - [x] peer dependencies
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { Storage, type StorageOptions } from './storage';
|
||||
|
||||
export interface BlobStorageOptions extends StorageOptions {}
|
||||
|
||||
export interface BlobRecord {
|
||||
key: string;
|
||||
data: Uint8Array;
|
||||
mime: string;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface ListedBlobRecord {
|
||||
key: string;
|
||||
mime: string;
|
||||
size: number;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export abstract class BlobStorage<
|
||||
Options extends BlobStorageOptions = BlobStorageOptions,
|
||||
> extends Storage<Options> {
|
||||
override readonly storageType = 'blob';
|
||||
|
||||
abstract get(key: string): Promise<BlobRecord | null>;
|
||||
abstract set(blob: BlobRecord): Promise<void>;
|
||||
abstract delete(key: string, permanently: boolean): Promise<void>;
|
||||
abstract release(): Promise<void>;
|
||||
abstract list(): Promise<ListedBlobRecord[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user