Gaia/Contacts/Data Refactor/mozcontactsProposal
Introduction
This proposal advocates for collapsing two datastores (mozContacts and GCDS) into one. As a result the role of the GlobalContactsDatastore will played by the regular mozContacts datastore. An entry in the referred datastore could have local data and/or pointers to contacts present in the external providers datastores (Facebook, Gmail, etc.). We will be providing a library that will allow to resolve a mozContact to the real data it should have, as it has already been done with the MultiContact library.
To support this apprach the mozContact object will be extended with a 'sources' attribute (vcard standard) that will allow us to store the datastore provider and the id of the "linked" contacts. There can be contacts in the system that only exist in the external service and in that case all the mozContact attributes will be empty apart from the referred 'sources' attribute.
How it works
Advantages
- We keep mozContacts as the Contact authority in the system. If there is a Contact known to the system then it will be present on the mozContacts store. As a result any app will be able to get access to it, although they might not to be able to get access to all of the data, as the datastores themselves will impose access levels restrictions.
- Whenever a change is made locally it is automatically propagated and we will not need to wait for the propagation of changes between the different datastores and indexedDBs.
- We can keep very easily the existing functionality of contacts merging, import from SIM, vCard, Facebook, etc. This proposal enables an easy migration path.