Closed Bug 1636365 Opened 4 years ago Closed 4 years ago

Refactor trackers for bridged engines

Categories

(Firefox :: Sync, task)

task

Tracking

()

RESOLVED FIXED
Firefox 78
Tracking Status
firefox78 --- fixed

People

(Reporter: lina, Assigned: lina)

References

Details

Attachments

(2 files)

I didn't spend much time on the BridgedTracker stub, but it's not quite enough to build your own tracker. In practice, bridged trackers will only do the "listen for observer notifications and bump the score" part, and not persist a list of changed IDs.

I think a better way to do this is to split out persistence into a PersistentTracker, put a scary "don't use this" comment above it, and make the engines that actually need it (add-ons, clients, forms, history, and passwords) use it. Everyone else can use the base tracker that throws if you try to make it persist anything.

(I thought about doing this while I was adding more docs for BridgedEngine, let's do that, too!).

Actually, I'm going to be more opinionated, and call it a LegacyTracker! 😈

Yes! That's exactly the kind of optimism that's lead to us hauling around a scope named "oldsync" for all these years :thumbsup:

(Seriously though, +1 to the name)

The tracker base class currently does two things: bump the score in
response to observer notifications, and store a list of changed IDs.
The bookmarks, form autofill, and now bridged trackers need to hack
around this to opt out of persistence, since they handle change
tracking in the storage layer.

This commit keeps the score logic in Tracker, but moves all the
persistence code into an intermediate LegacyTracker class, and
changes all engines that need persistence to inherit from it.

ignoreAll is more interesting. We want new-style stores to emit
observer notifications with change sources, so that the tracker knows
to ignore changes made by Sync. Ignoring all observer notifications
during a sync is a blunter version of this. But, not every new store
supports change sources, so we reimplement ignoreAll manually for
ones that don't.

Now that we have a Tracker base class without persistence, we can
have bridged engines subclass it directly.

Depends on D74374

Yes! That's exactly the kind of optimism that's lead to us hauling around a scope named "oldsync" for all these years :thumbsup:

🤣🤣🤣

A girl can dream, right? Right? ☀️

Attachment #9146702 - Attachment description: Bug 1636365 - Split out persistence from `Tracker` into `LegacyTracker`. r?markh! → Bug 1636365 - Split out persistence from `Tracker` into `LegacyTracker`. r?markh!,rfkelly
Attachment #9146703 - Attachment description: Bug 1636365 - Add more docs for `BridgedEngine`, and remove `BridgedTracker`. → Bug 1636365 - Add more docs for `BridgedEngine`, and remove `BridgedTracker`. r?markh!,rfkelly
Pushed by kcambridge@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/40d980163482
Split out persistence from `Tracker` into `LegacyTracker`. r=markh,rfkelly
https://hg.mozilla.org/integration/autoland/rev/86a1d0814d03
Add more docs for `BridgedEngine`, and remove `BridgedTracker`. r=markh,rfkelly
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
Regressions: 1639727
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: