feat(nbstore): rename SyncStorage to DocSyncStorage (#10751)

This commit is contained in:
EYHN
2025-03-14 06:25:26 +00:00
parent 92effd9b51
commit f3ef9c4415
19 changed files with 90 additions and 79 deletions

View File

@@ -1,5 +1,8 @@
import { IndexedDBDocStorage, IndexedDBSyncStorage } from '@affine/nbstore/idb';
import { SqliteDocStorage, SqliteSyncStorage } from '@affine/nbstore/sqlite';
import {
IndexedDBDocStorage,
IndexedDBDocSyncStorage,
} from '@affine/nbstore/idb';
import { SqliteDocStorage, SqliteDocSyncStorage } from '@affine/nbstore/sqlite';
import type { StoreClient } from '@affine/nbstore/worker/client';
import { Entity } from '@toeverything/infra';
@@ -16,10 +19,10 @@ export class UserDBEngine extends Entity<{
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS
? SqliteDocStorage
: IndexedDBDocStorage;
SyncStorageType =
DocSyncStorageType =
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS
? SqliteSyncStorage
: IndexedDBSyncStorage;
? SqliteDocSyncStorage
: IndexedDBDocSyncStorage;
canGracefulStop() {
// TODO(@eyhn): Implement this
@@ -44,8 +47,8 @@ export class UserDBEngine extends Entity<{
type: 'userspace',
},
},
sync: {
name: this.SyncStorageType.identifier,
docSync: {
name: this.DocSyncStorageType.identifier,
opts: {
id: `${serverService.server.id}:` + this.userId,
type: 'userspace',

View File

@@ -14,7 +14,7 @@ import { CloudBlobStorage, StaticCloudDocStorage } from '@affine/nbstore/cloud';
import {
IndexedDBBlobStorage,
IndexedDBDocStorage,
IndexedDBSyncStorage,
IndexedDBDocSyncStorage,
} from '@affine/nbstore/idb';
import {
IndexedDBV1BlobStorage,
@@ -23,7 +23,7 @@ import {
import {
SqliteBlobStorage,
SqliteDocStorage,
SqliteSyncStorage,
SqliteDocSyncStorage,
} from '@affine/nbstore/sqlite';
import {
SqliteV1BlobStorage,
@@ -111,10 +111,10 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
: BUILD_CONFIG.isWeb || BUILD_CONFIG.isMobileWeb
? IndexedDBV1BlobStorage
: undefined;
SyncStorageType =
DocSyncStorageType =
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS
? SqliteSyncStorage
: IndexedDBSyncStorage;
? SqliteDocSyncStorage
: IndexedDBDocSyncStorage;
async deleteWorkspace(id: string): Promise<void> {
await this.graphqlService.gql({
@@ -431,8 +431,8 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
id: workspaceId,
},
},
sync: {
name: this.SyncStorageType.identifier,
docSync: {
name: this.DocSyncStorageType.identifier,
opts: {
flavour: this.flavour,
type: 'workspace',

View File

@@ -8,7 +8,7 @@ import {
import {
IndexedDBBlobStorage,
IndexedDBDocStorage,
IndexedDBSyncStorage,
IndexedDBDocSyncStorage,
} from '@affine/nbstore/idb';
import {
IndexedDBV1BlobStorage,
@@ -17,7 +17,7 @@ import {
import {
SqliteBlobStorage,
SqliteDocStorage,
SqliteSyncStorage,
SqliteDocSyncStorage,
} from '@affine/nbstore/sqlite';
import {
SqliteV1BlobStorage,
@@ -97,10 +97,10 @@ class LocalWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
: BUILD_CONFIG.isWeb || BUILD_CONFIG.isMobileWeb
? IndexedDBV1BlobStorage
: undefined;
SyncStorageType =
DocSyncStorageType =
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS
? SqliteSyncStorage
: IndexedDBSyncStorage;
? SqliteDocSyncStorage
: IndexedDBDocSyncStorage;
async deleteWorkspace(id: string): Promise<void> {
setLocalWorkspaceIds(ids => ids.filter(x => x !== id));
@@ -321,8 +321,8 @@ class LocalWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
id: workspaceId,
},
},
sync: {
name: this.SyncStorageType.identifier,
docSync: {
name: this.DocSyncStorageType.identifier,
opts: {
flavour: this.flavour,
type: 'workspace',