feat(nbstore): new doc sync engine (#8918)

This commit is contained in:
EYHN
2024-12-07 08:05:02 +00:00
parent fafacdb265
commit f54f6e88cb
23 changed files with 1252 additions and 43 deletions
@@ -0,0 +1,18 @@
import type { DocStorage, SyncStorage } from '../../storage';
import { DocSyncPeer } from './peer';
export class DocSyncEngine {
constructor(
readonly local: DocStorage,
readonly sync: SyncStorage,
readonly peers: DocStorage[]
) {}
async run(signal?: AbortSignal) {
await Promise.all(
this.peers.map(peer =>
new DocSyncPeer(this.local, this.sync, peer).mainLoop(signal)
)
);
}
}