mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-08 12:45:55 +08:00
feat(nbstore): add nbstore worker (#9185)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { share } from '../../../connection';
|
||||
import { BlobStorage, type ListedBlobRecord } from '../../../storage';
|
||||
import { BlobStorageBase, type ListedBlobRecord } from '../../../storage';
|
||||
import { BlobIDBConnection } from './db';
|
||||
|
||||
/**
|
||||
* @deprecated readonly
|
||||
*/
|
||||
export class IndexedDBV1BlobStorage extends BlobStorage {
|
||||
export class IndexedDBV1BlobStorage extends BlobStorageBase {
|
||||
readonly connection = share(new BlobIDBConnection(this.spaceId));
|
||||
|
||||
get db() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type DBSchema, type IDBPDatabase, openDB } from 'idb';
|
||||
|
||||
import { Connection } from '../../../connection';
|
||||
import { AutoReconnectConnection } from '../../../connection';
|
||||
|
||||
export interface DocDBSchema extends DBSchema {
|
||||
workspace: {
|
||||
@@ -15,7 +15,9 @@ export interface DocDBSchema extends DBSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export class DocIDBConnection extends Connection<IDBPDatabase<DocDBSchema>> {
|
||||
export class DocIDBConnection extends AutoReconnectConnection<
|
||||
IDBPDatabase<DocDBSchema>
|
||||
> {
|
||||
override get shareId() {
|
||||
return 'idb(old):affine-local';
|
||||
}
|
||||
@@ -40,7 +42,9 @@ export interface BlobDBSchema extends DBSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export class BlobIDBConnection extends Connection<IDBPDatabase<BlobDBSchema>> {
|
||||
export class BlobIDBConnection extends AutoReconnectConnection<
|
||||
IDBPDatabase<BlobDBSchema>
|
||||
> {
|
||||
constructor(private readonly workspaceId: string) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { share } from '../../../connection';
|
||||
import { type DocRecord, DocStorage, type DocUpdate } from '../../../storage';
|
||||
import {
|
||||
type DocRecord,
|
||||
DocStorageBase,
|
||||
type DocUpdate,
|
||||
} from '../../../storage';
|
||||
import { DocIDBConnection } from './db';
|
||||
|
||||
/**
|
||||
* @deprecated readonly
|
||||
*/
|
||||
export class IndexedDBV1DocStorage extends DocStorage {
|
||||
export class IndexedDBV1DocStorage extends DocStorageBase {
|
||||
readonly connection = share(new DocIDBConnection());
|
||||
|
||||
get db() {
|
||||
|
||||
Reference in New Issue
Block a user