Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/json-crdt-patch/clock/__tests__/clock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ test('forking clones all clocks in vector', () => {
expect(cloned.peers.get(4)!.time).toBe(2);
expect(cloned.peers.get(5)!.time).toBe(4);
});

test('', () => {

});
8 changes: 8 additions & 0 deletions src/json-crdt-patch/clock/clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ export class ClockVector extends LogicalClock implements IClockVector {
return clock;
}

public toCompact(): number[] {
const result: number[] = [this.sid, this.time - 1];
this.peers.forEach(ts => {
result.push(ts.sid, ts.time);
});
return result;
}

/**
* Returns a human-readable string representation of the clock vector.
*
Expand Down
Loading