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

fast forward remote changes #96

Open
jchris opened this issue Feb 18, 2024 · 2 comments
Open

fast forward remote changes #96

jchris opened this issue Feb 18, 2024 · 2 comments

Comments

@jchris
Copy link
Contributor

jchris commented Feb 18, 2024

When a remote makes a sequence of changes in quick succession, they might come faster than the local can merge them.

Most of the time when this happens we can just skip to the most recent one, assuming they are a direct chain of parent/child relationships.

https://www.youtube.com/watch?v=j0X9fRf4cTk

The video shows the queue buildup we can fast foward.

Here is the code to where we can fast foward through parent child chains in the queue

await worker(task.newHead, task.prevHead, task.updates !== null)

@jchris
Copy link
Contributor Author

jchris commented Feb 18, 2024

Immediately after composing the above, I realized this is the correct concept but the wrong CRDT. It should be applied in the encrypted-blockstore module which means doing the work of making DbMeta track parents properly (currently hacked in as runtime state). see

async mergeDbMetaIntoClock(meta: DbMeta): Promise<void> {
for where it should be applied

@jchris
Copy link
Contributor Author

jchris commented Feb 18, 2024

Maybe we need to add parents array to this type, where the parents are links to the same type

export type DbMetaEventBlock = EventBlock<{ dbMeta: Uint8Array }>
DbMetaEventBlock

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

No branches or pull requests

1 participant