Implement an asynchronous transaction manager module

NEW
Assigned to

Status

()

Toolkit
Async Tooling
4 years ago
4 years ago

People

(Reporter: WeirdAl, Assigned: WeirdAl)

Tracking

(Blocks: 1 bug)

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
I think I will break this patch up into several incremental patches:

* Inline API documentation, errors and basic infrastructure (stack of transactions, PromiseAction, isInTransaction)
* doTransaction
* undoTransaction
* redoTransaction
* Transaction listeners
* Merging transactions
* Transaction metadata
* Undo / redo stacks (getting, clearing)

Each phase will have its own tests as well.
(Assignee)

Comment 1

4 years ago
Created attachment 8519454 [details] [diff] [review]
part 1:  Define the API.
Attachment #8519454 - Flags: review?(dteller)
Can you describe the expected use case for this ATM?
Flags: needinfo?(ajvincent)
Comment on attachment 8519454 [details] [diff] [review]
part 1:  Define the API.

Review of attachment 8519454 [details] [diff] [review]:
-----------------------------------------------------------------

At first glance, the API looks sound, but I can't review it until I have a good idea of the usecase.
Attachment #8519454 - Flags: review?(dteller)
(Assignee)

Comment 4

4 years ago
The immediate use case is Firefox's addons manager:
http://hg.mozilla.org/mozilla-central/annotate/ae27ae77e32f/toolkit/mozapps/extensions/internal/XPIProvider.jsm#l297

You may recall that the AOM uses several sychronous nsIFile operations to update an addon, for instance.  AOM's actually implementing a simple transaction with its SafeInstallOperation code.  Bug 945540 is about converting to OS.File and Promises for asynchronous operations, so it could use the Transaction code I've implemented.

(That being said, AOM may not require the full AsyncTransactionManager, just a singleton Transaction.  I'm willing to redesign for that purpose only, if you require this.)

Mozilla's built-in transaction manager component (editor/txmgr) supports undo/redo operations in general, but is not designed for asynchronous operations.  I implemented AsyncTransactionManager for that purpose in my Verbosio project, so that I could have undo and redo capabilities for async, atomic changes.
Flags: needinfo?(ajvincent)
You need to log in before you can comment on or make changes to this bug.