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

Implement storage #10

Open
2 tasks
georgehrke opened this issue Aug 18, 2018 · 6 comments
Open
2 tasks

Implement storage #10

georgehrke opened this issue Aug 18, 2018 · 6 comments
Labels
enhancement New feature or request

Comments

@georgehrke
Copy link
Member

  • Allow users to hand over a storage object (whether it's SessionStorage, LocalStorage or something completely different)
  • Save all objects / properties to Storage
@georgehrke georgehrke added this to the 0.0.3 milestone Aug 18, 2018
@georgehrke georgehrke added the enhancement New feature or request label Aug 18, 2018
@georgehrke
Copy link
Member Author

This will also help with mitigating internet connectivity issues.
Changes will be written to the storage object. CDAV-Library will remember that the changes have not been synced to the server yet and will sync them whenever the internet connection is back.

@skjnldsv
Copy link
Member

I'm not sure this should be the role of this lib?
I mean, how does our apps should understand that there are changes pending and not every data is updated?

@georgehrke
Copy link
Member Author

Yes, I get your point. I'm not 100% sure whether this should be the job of the Calendar / Contacts app or this library.

My idea was to introduce a method hasUnsynchedChanges() and introducing a sync method, that should periodically be called by the application using cdav-library.

One of the biggest issues, at least in the calendar app, is the waiting time of at least 5 seconds to load all calendars when you open the calendar app. I would just like to cache all vobjects / vcards, like your desktop and mobile cal- / carddav clients do, to use that data and then once the initial view is rendered, query the server for updates.

@skjnldsv
Copy link
Member

I feel like this is not the job of the lib, but can't really figure out why. ^^
If we successfully implement this feature without the app knowing about it (I mean like no differences at all) then I feel like this is a great idea. If we have to implement specific stuff in the app to manage this feature then we should probably do that in our app instead?

@georgehrke
Copy link
Member Author

I feel like this is not the job of the lib, but can't really figure out why. ^^
[...]
If we have to implement specific stuff in the app to manage this feature then we should probably do that in our app instead?

I have this feeling too a little.
But if we implement it in the app, we will have almost 3 identical implementations and lots of duplicate code.

Let's just discuss this feature at Nextcloud conference! :)

@georgehrke
Copy link
Member Author

Taking into account @MorrisJobke's feedback from today, I propose the following:

  • allow developers to hand over storage object to cdav library
  • all the API calls are the same, whether you hand over a storage object or not
  • when you don't handover a storage object:
    • every findAll() / find() request will send new requests to the server
    • sync() will simple resolve to true without doing anything
  • when you handover a storage object:
    • send collection-sync on every sync() request to slowly build up storage
    • if you send any findAll() / find() / findInTime() / etc. requests and the initial sync has not been finalised, it will first send a request only for the paths & etags, to check if the contacts / calendar objects are already available locally
    • if not, it will send a multi get and add them to the cache.
    • when everything was cached, findAll()/etc. will automatically resolve from storage object and sync will check for changed sync-tokens.

Does this make sense to everyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants