Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indexing structure to accelerate lookups #6

Merged

Conversation

anthony-murphy
Copy link
Owner

No description provided.


public setMinSeq(minSeq: number): void {
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
while (!this.seqOrdered.empty && this.seqOrdered.first?.data.seq! <= minSeq) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this now does nothing if there are not obliterates, and it's at most O(n) for the number of obliterates

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're at the minSeq, does that mean that the obliterate should be considered out of the collabWindow? I had been assuming that it was the opposite (===minSeq means still inside collabWindow).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minSeq is the lowest seq all clients have seen, so if there is an obliterate at the minSeq it means it was seen by all clients, and therefore shouldn't remove anything more, as only clients that haven't see the obliterate should have their inserts removed.


public findOverlapping(seg: ISegment): Iterable<ObliterateInfo> {
const overlapping: ObliterateInfo[] = [];
for (const start of this.startOrdered.items) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worst case scenario this is O(n) for the number of obliterates. we could probably accelerate this further with a tree.

@anthony-murphy anthony-murphy merged commit 2e67ff1 into LocalReferenceObliterate Sep 12, 2024
8 checks passed
@anthony-murphy anthony-murphy deleted the LocalReferenceObliterate-with-index branch September 12, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants