Skip to content

Commit

Permalink
untested: constructor arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
CAWorks-ChrisA committed Sep 30, 2024
1 parent 715aa87 commit 0041767
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/adaptors/yjs-ndn-adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ export class NdnSvsAdaptor {
public syncAgent: SyncAgent,
public readonly doc: Y.Doc,
public readonly topic: string,
public readonly snapshotTopic: string = 'snapshot',
public readonly snapshotFrequency: number = 10,
useBundler: boolean = false,
) {
syncAgent.register('update', topic, (content) => this.handleSyncUpdate(content));
// Adam Chen callback on receiving a snapshot blob for Injection Point 3
syncAgent.register('blob', 'snapshot', (content) => this.handleSnapshotUpdate(content));
syncAgent.register('blob', snapshotTopic, (content) => this.handleSnapshotUpdate(content));
doc.on('update', this.callback);
if (useBundler) {
this.#bundler = new Bundler(
Expand Down Expand Up @@ -118,7 +120,7 @@ export class NdnSvsAdaptor {
}
// Snapshot Interval configuration: Currently hard-coded
// TODO: make the interval configurable
if (count % 5 == 0) {
if (count % this.snapshotFrequency == 0) {
const encodedSV = Encoder.encode(stateVector);

// NOTE: The following code depend on snapshot naming convention to work.
Expand Down

0 comments on commit 0041767

Please sign in to comment.