remote_settings::cache

Function merge_cache_and_response

source
pub fn merge_cache_and_response(
    cached: RemoteSettingsResponse,
    new: RemoteSettingsResponse,
) -> RemoteSettingsResponse
Expand description

Merge a cached RemoteSettingsResponse and a newly downloaded one to get a merged response

cached is a previously downloaded remote settings response (possibly run through merge_cache_and_response). new is a newly downloaded remote settings response (with _expected set to the last_modified time of the cached response).

This will merge the records from both responses, handle deletions/tombstones, and return a response that has:

  • The newest last_modified_date
  • A record list containing the newest version of all live records. Deleted records will not be present in this list.

If everything is working properly, the returned value will exactly match what the server would have returned if there was no _expected param.