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

can we filter the sync protocol messages based on the automerge.change message? #240

Open
michaelpalumbo opened this issue Jul 10, 2023 · 0 comments
Assignees

Comments

@michaelpalumbo
Copy link
Collaborator

michaelpalumbo commented Jul 10, 2023

use: given a set of incoming changes, if we have their change messages (i.e. 'add op', 'add cable', 'update param value') then we can tell Patch.js to set the dirty flag(s) only for the associated part of the system. in other words, if a module's position or quaternion is changed, there's no reason to set the this.dirty.audio.param as true. (and it will cause unnecessary prcoessing of graph and/or audio graph changes if we are setting all the flags to true each time we receive an automerge sync message (which can be very often))

follow this issue I posted here

// possible pseudocode
// after we receive a sync message and apply it to the doc in *Patch.js:receiveSyncMessages:case 'syncMessage'*
let changes = Automerge.getChanges(this.document, nextDoc) // note this is returns a Uint8Array
// run a for..loop to process each change
// write a switch statement on each change message
switch (changeMsg) {
  case 'add op':
    this.dirty.vr = true
    this.dirty.audio.graph = true
  break;
  case 'param':
    this.dirty.vr = true
    this.dirty.audio.param = true
  break;  
}
@michaelpalumbo michaelpalumbo self-assigned this Jul 10, 2023
@michaelpalumbo michaelpalumbo changed the title can sync protocol messages contain the automerge.change message? can we filter the sync protocol messages based on the automerge.change message? Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant