Skip to content

Commit

Permalink
Clean up codes
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Nov 20, 2024
1 parent 8adb6ed commit 2846be1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions packages/sdk/src/document/time/version_vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ export class VersionVector {
* `minLamport` returns min lamport value from vector
*/
public minLamport(): bigint {
// 2^63 -1 (in64 max)
// TODO(hackerwins): If the version vector is empty, minLamport could be the
// max value of int64. This is because if the last client leaves the
// document, the min version vector becomes empty.
// This is a temporary solution and needs to be fixed later.

// 2^63-1 (int64 max)
let min = 9223372036854775807n;

for (const [, lamport] of this) {
Expand Down Expand Up @@ -111,9 +116,7 @@ export class VersionVector {
const lamport = this.vector.get(other.getActorID());

if (lamport === undefined) {
const minLamport = this.minLamport();

return !!minLamport && minLamport > other.getLamport();
return this.minLamport() > other.getLamport();
}

return lamport >= other.getLamport();
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/test/integration/tree_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2462,8 +2462,7 @@ describe('Tree.edit(concurrent, contained range)', () => {
}, task.name);
});

// TODO(JOOHOJANG)
// split operation's defect cause GC error.
// TODO(JOOHOJANG): split operation's defect cause GC error.
// remove this comment after implement split operation completely.
it.skip('contained-split-and-delete-contents-in-split-node', async function ({
task,
Expand Down

0 comments on commit 2846be1

Please sign in to comment.