-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat!: expose device-specific sync state #757
Conversation
`myProject.$sync.getState()` and the `sync-state` event now return objects like this: ```javascript { initial: { isSyncEnabled: true }, data: { isSyncEnabled: true }, remoteDeviceSyncState: { abc123: { initial: { isSyncEnabled: true, want: 0, wanted: 0 }, data: { isSyncEnabled: true, want: 2, wanted: 0 }, }, def456: { initial: { isSyncEnabled: true, want: 0, wanted: 0 }, data: { isSyncEnabled: true, want: 0, wanted: 1 }, }, }, } ``` In English, this means: - We now have sync information for individual peers, instead of aggregated info. - `want` and `wanted` have slightly different meaning than before. `want` is the number of blocks a peer wants from us, and `wanted` is the number of blocks we want from a specific peer. For example, imagine peers A, B, and C are connected and syncing. Peer A has observation 1, B has observation 2 and 3, and C has nothing. Each of these peers has a relationship: - From A's perspective... - B wants 1 observation from us and has 2 observations it knows we want. - C wants 1 observation from us. - From B's perspective... - A wants 2 observations from us and has 1 observation is knows we want. - C wants 2 observations from us. - From C's perspective... - A has 1 observation is knows we want, and wants nothing from us. - A has 2 observations is knows we want, and wants nothing from us. - Some data should now be inferred. For example, the number of peers is now the number of keys in `remoteDeviceSyncState`, not a calculated value. - `have` and `missing` were removed from remote states, because they are unused. Closes [#743]. [#743]: #743 Co-authored-by: Tomás Ciccola <[email protected]>
@@ -128,7 +128,6 @@ | |||
"cpy-cli": "^5.0.0", | |||
"drizzle-kit": "^0.20.14", | |||
"eslint": "^8.57.0", | |||
"filter-obj": "^6.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer used.
export const DATA_NAMESPACES = NAMESPACES.filter( | ||
(ns) => !PRESYNC_NAMESPACES.includes(ns) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ufff, fixing all of this 😰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesomee 🚀
@EvanHahn unfortunately this won't give us quite the information we want for sync progress. I'm also not sure how you are handling I think the way to solve the front-end requirement for sync state for both syncing and non-syncing peers is to aggregate syncing and non-syncing cores separately, and to pass the aggregated values as the sync state, with the same |
ok I've been able to review this in more detail. I think dropping |
myProject.$sync.getState()
and thesync-state
event now return objects like this:In English, this means:
We now have sync information for individual peers, instead of aggregated info.
want
andwanted
have slightly different meaning than before.want
is the number of blocks a peer wants from us, andwanted
is the number of blocks we want from a specific peer.For example, imagine peers A, B, and C are connected and syncing. Peer A has observation 1, B has observation 2 and 3, and C has nothing. Each of these peers has a relationship:
Some data should now be inferred. For example, the number of peers is now the number of keys in
remoteDeviceSyncState
, not a calculated value.have
andmissing
were removed from remote states, because they are unused.Closes #743.