Rename `StorageOp` to `Punt` or `Ferry`
Categories
(WebExtensions :: Storage, task)
Tracking
(firefox78 fixed)
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++ Op
s 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?
Comment 1•5 years ago
|
||
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.
Comment 2•5 years ago
|
||
punt
WFM too
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
bugherder |
Description
•