Gaia/Contacts/Data Refactor: Difference between revisions

Jump to navigation Jump to search
Line 76: Line 76:


== Platform requirements ==
== Platform requirements ==
In order to do this we sill have some requirements that needs to be implemented in the platform.
In order to do this we still have some requirements that needs to be implemented in the platform.


=== Expose mozContacts API content as a datastore ===
=== Expose mozContacts API content as a datastore ===
Line 82: Line 82:
More background about this change can be read on this [https://groups.google.com/forum/#!topic/mozilla.dev.webapi/C2L9PdFMO7Q mailing list thread] and {{bug|1016838}}.
More background about this change can be read on this [https://groups.google.com/forum/#!topic/mozilla.dev.webapi/C2L9PdFMO7Q mailing list thread] and {{bug|1016838}}.


=== System message when data changes in datastores (DONE) ===
=== Notification mechanism about datastore changes (aka DataStore onchange scheduler) ===
In order to make the flow happen when changes are performed in the different datastores, we will need to be able to receive system messages if a DS changes in our app. {{bug|1014023}}
The GCDS app needs to receive notifications about changes on the datastores owned by all the Contact Providers that are registered in the GCDS. To do that we have two ways of receiving this kind of notifications:
* Via the '''''onchange''''' event, that will be received by the GCDS '''while the app is running'''.
* Via the '''''datastore-change-*''''' system message, that the GCDS needs to listen to be '''woken up''' when a change in an observed datastore is identified. This system message was added on {{bug|1014023}}
We believe that these two mechanisms are not enough to fulfill the needs of the proposed architecture the way they are implemented right now for the following reasons.


=== DataStore change scheduler instead of datastore-change-* system message ===
* '''There is no way to know when a new Contact Provider is added'''
In order to add a new Contact Provider datastore information and its corresponding contained data pointers to the list of providers stored in the GCDS we need to be notified about new installed apps exposing a datastore named ''contacts''.
Currently, we are able to request a list of all the datastores with an specific name from the GCDS app, but to do that the GCDS needs to be opened. And this only happens when a contact is changed in any of the already registered Contact Providers, which could happen immediately, next month or never. So we need a way to wake the GCDS up to do the proper registration of the new installed Contact Provider. We can simply trigger the datastore-change-* notification as soon as we detect a new datastore named X. The GCDS will be responsible to look for not already registered Contact Providers once it is woken up by the system message.


=== Mechanism to acknowledge the reception and processing of the datastore change notification ===
* '''Potential desynchronization between Contact Providers content and GCDS'''
Because we have no way to acknowledge the reception and completion of the processing of a change notification we may have an scenario where:


=== System message when a specific datastore is added ===
# A bunch of contacts are added and removed from a Contact Provider being watched by the GCDS. This triggers the ''datastore-change-*'' notification.
In order to add a new Contact Provider datastore information and its corresponding contained data pointers to the list of providers stored in GCDS we need to be notified about new installed apps exposing a datastore named ''contacts''.
# The GCDS wakes up as response to the ''datastore-change-*'' notification.
Currently, we are able to request a list of all the datastores with an specific name from the GCDS app, but to do that the GCDS needs to be opened. And this only happens when a contact is changed in any of the already registered Contact Providers, which could happen immediately, next month or never. So we need a way to wake this app up to do the proper registration of the new Contact Provider. We can reuse the datastore change notification that can be fired as soon as we detect a new datastore named X.
# The GCDS starts syncing with the observed Contact Provider datastore.
# The GCDS is killed by the system.
# We loose these changes :(
 
* '''Potential performance foot gun'''


TODO: file bug.


=== DataStore permission model ===
=== DataStore permission model ===
Confirmed users
483

edits

Navigation menu