What to do with remote resources that disappear
I've been working on the refreshing code for the EEStore, that is: refetching data from remotes to discover changes (this updates last_fetched).
One thing is: the original spec doesn't have any notion of a "last modified"-date, so that's not supported. Understandable, some remotes have a notion of last modified but most don't.
Much worse: different remotes treat deletion of data differently, and this hasn't been considered at all (not mentioned in the original spec). Some set a flag marking that a record is deleted, others delete the record. But what EEStore should do in either case is unclear. Currently, the last_fetched date is not updated so that at least it is possible to see that the record is outdated.
When a record on a remote has been deleted, what should the EEStore pass on, and what should it do with its cache? There are basically two possibilities:
- Mark the record as deleted and keep it in the cache (and have a filter to hide or only fetch deleted records)
- Erase the record in the cache and stop sending it out to clients
As for 1 there are two relevant implementation methods: a) a boolean (deleted=true vs. deleted=false) or b) a date (deleted_at=date vs. deleted_at is unset/nil. I tend to prefer option b).
(I just discovered that 83 records classified as "project" has disappeared from CRISTIN since that last time I fetched data from them.)