DownloadContentCatalog: Consider storing items in JSON object instead of plain array

RESOLVED FIXED in Firefox 47

Status

()

Firefox for Android
General
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: sebastian, Assigned: sebastian)

Tracking

unspecified
Firefox 47
All
Android
Points:
---

Firefox Tracking Flags

(firefox47 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
.. just in time before we enable this in Nightly. While working on the background service for feeds and thinking about how to persist some data I looked at the DownloadContentCatalog again.

Currently we store the catalog as a JSON array on disk:
> [
>   { .. content descriptor .. },
>   { .. content descriptor .. },
>   { .. content descriptor .. },
>   ..
> ]

Maybe we should instead store this as a JSON object like:
> {
>    "content": [
>        { .. content descriptor .. },
>        { .. content descriptor .. },
>        { .. content descriptor .. },
>        ..
>    ]
>
> }

Two reasons why I think this could be more useful:

* This allows us to store additional meta data in the object: Last time updated, ... whatever might be useful in the future - especially when we start to build the client for synchronizing the catalog

* If we are ever going to migrate the schema then it's probably easier to work with a flexible object than just an array of things.
(Assignee)

Updated

3 years ago
Blocks: 1233799
Summary: DownloadContentCatalog: Consider storing item in JSON object instead of array → DownloadContentCatalog: Consider storing items in JSON object instead of plain array
(Assignee)

Comment 1

3 years ago
Created attachment 8713559 [details] [diff] [review]
1243817-DLC-catalog-object.patch

This was also a good test for the "broken JSON" case: The catalog was rejected and recreated. After that all content has been marked as downloaded because everything already existed locally and had the correct checksum.
Attachment #8713559 - Flags: review?(rnewman)
Attachment #8713559 - Flags: review?(rnewman) → review+
(Assignee)

Comment 2

3 years ago
https://hg.mozilla.org/integration/fx-team/rev/780e888f7df54358aaf517b375f7749c8a16c85d
Bug 1243817 - DownloadContentCatalog: Store catalog as JSON object instead of array. r=rnewman

Comment 3

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/780e888f7df5
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox47: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
You need to log in before you can comment on or make changes to this bug.