Skip to content

Conversation

@samholmes
Copy link
Contributor

@samholmes samholmes commented Dec 4, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

throw error
},

async syncRepo(disklet, syncKey, lastHash) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems reasonable. However, this should not be public API. Instead, we want to export a makeSyncedDisklet(parentPath: Disklet) => Disklet & { sync() => Promise<string[]> }.

You do const myDisklet = makeSyncedDisklet(...), and then you can do myDisklet.getText, myDisklet.delete, myDisklet.setText, and so forth. This library automatically routes the changes to the right places (/data, /changes, /deleted). Finally, you can do myDisklet.sync() to sync with the server.

This keeps the details fully black-boxed. The contents of the "status.json", the layout of the sub-folders (/data, /changes, /deleted), and the details of the sync algorithm are fully abstracted. Remember when we built the change server? We built the "legacy" API compatible with the existing core, and we also defined the "new" API with faster sync. We never implemented the client side of the "new" API, but if we wanted to do that, we would want edge-sync-client to be "black-boxed" so the change can be seamless. If the core has to "know" the format of the "status.json" or the general on-disk layout of the repo, we have failed.

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.

3 participants