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

Synchronization between local/memory storage and external/file/db storage #440

Open
1 task
Rednas83 opened this issue May 5, 2024 · 0 comments
Open
1 task

Comments

@Rednas83
Copy link

Rednas83 commented May 5, 2024

Describe the feature

Would be cool if support could be added for an optional synchronization mechanism to support offline usage of external storage.

Something like

const user = await useStorage().login('user1') // local authentication
try {
  const dataStorage = useStorage('data').setItem('test', 'works') // set item online if possible otherwise use the local storage as a fallback
}
catch (e) {
 const popup = await popup(`Solve conflict for (${e.description})`, e.newValue, e.differentValue) // Provide mechanism for solving conflicts when the connection is restored
}
await useStorage().getItem('data:test') // Can be accesed from memory when the storage is already in sync with the external storage
await user.logoff()

Advantages

  • Work offline without server connection
  • Solve conflicts when the server connection is restored by returning errors with the values that are not matching
  • More app performance because local storage is used

Disadvantages

  • Requires timestamping and support for users I guess to support solving conflicts
  • Slower storage on the server
  • Less secure?

Additional information

  • Would you be willing to help implement this feature?
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