Closed Bug 1636792 Opened 5 years ago Closed 4 years ago

Rename `StorageOp` to `Punt` or `Ferry`

Categories

(WebExtensions :: Storage, task)

task

Tracking

(firefox78 fixed)

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: lina, Assigned: lina)

Details

Attachments

(1 file)

Currently, the type for an operation that we run on a background thread in the new Rust extension storage is StorageOp. It's the same idea as a Golden Gate Ferry, and an FxA Punt.

Even though none of those three types inherits behavior or functionality from a common base, they all do the same thing, and giving them different names feels like it obscures things. Having to remember, "oh, right, this is an Op, which is the same thing as a Punt, which is the same thing as a Ferry" adds cognitive load when reading the code.

Of those three, I like Punt—it stands out, easy to grep for in Searchfox (the number of C++ Ops we have is 🤯) and has a nice mnemonic: we're punting a synchronous operation to a background thread pool. I do like Ferry, too, but I'm biased, and having both golden_gate::Ferry and webext_storage_bridge::Ferry means we have to rename one on import. When/if we abstract Ferry to mean "a generic operation with a generic callback that runs on a background thread," we can move everyone over. In the meantime, even reducing the number of names we have to two feels like an improvement.

We can also capture this in our Desktop Rust components cookbook. "Got a component with a synchronous API that you want to call from JS? Punt it to a background queue!"

WDYT?

Of those three, I like Punt—it stands out, easy to grep for in Searchfox and has a nice mnemonic: we're punting a synchronous operation
to a background thread pool

I also like "punt" the best, for similar reasons. I'll admit I was dubious about it at first, but it grew on me. We might be signing up for some verb/noun confusion, but if we succeed in making an abstraction with an appropriately narrow API, it should be OK.

punt WFM too

Assignee: nobody → lina
Status: NEW → ASSIGNED
Pushed by kcambridge@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5eb88ab60051 Rename `StorageOp` to `Punt` for consistency with FxA. r=markh
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: