feat(nbstore): add nbstore worker (#9185)

This commit is contained in:
EYHN
2024-12-20 08:01:23 +00:00
parent 30200ff86d
commit cbaf35df0b
51 changed files with 1144 additions and 501 deletions

View File

@@ -1,19 +1,23 @@
import { combineLatest, map, type Observable, of } from 'rxjs';
import type { BlobStorage, DocStorage, SpaceStorage } from '../storage';
import type { AwarenessStorage } from '../storage/awareness';
import { AwarenessSync } from './awareness';
import { BlobSync } from './blob';
import { DocSync, type DocSyncState } from './doc';
import type {
AwarenessStorage,
BlobStorage,
DocStorage,
SpaceStorage,
} from '../storage';
import { AwarenessSyncImpl } from './awareness';
import { BlobSyncImpl } from './blob';
import { DocSyncImpl, type DocSyncState } from './doc';
export interface SyncState {
doc?: DocSyncState;
}
export class Sync {
readonly doc: DocSync | null;
readonly blob: BlobSync | null;
readonly awareness: AwarenessSync | null;
readonly doc: DocSyncImpl | null;
readonly blob: BlobSyncImpl | null;
readonly awareness: AwarenessSyncImpl | null;
readonly state$: Observable<SyncState>;
@@ -28,7 +32,7 @@ export class Sync {
this.doc =
doc && sync
? new DocSync(
? new DocSyncImpl(
doc,
sync,
peers
@@ -37,7 +41,7 @@ export class Sync {
)
: null;
this.blob = blob
? new BlobSync(
? new BlobSyncImpl(
blob,
peers
.map(peer => peer.tryGet('blob'))
@@ -45,7 +49,7 @@ export class Sync {
)
: null;
this.awareness = awareness
? new AwarenessSync(
? new AwarenessSyncImpl(
awareness,
peers
.map(peer => peer.tryGet('awareness'))