-
Notifications
You must be signed in to change notification settings - Fork 161
Transaction specification
Version | User | Date | Notes |
---|---|---|---|
0.1 | Milko Venkov | Aug 30, 2018 | Initial Draft |
0.2 | Milko Venkov | Sep 04, 2018 | Transaction state |
igx-transaction
should be able to plug between given component and its data source. While plugged in igx-transaction
should collect all the changes performed in the component without send them to the data source. igx-transaction
should update the data source and commit all the changes.
- there is no end users stories as
igx-transaction
should be an Angular Service.
- be able to enable transaction on a given component
- be able to retrieve all the transactions - transaction log
- be able to get updated state of the data including all changes in the transaction log
- be able to update data source with all the changes currently in the transaction log
- be able to undo the last change
- be able to redo the change that was undone
- be able to reset all the changes in the transaction log
3.1. End User Experience
3.2. Developer Experience
Developers are able to inject the igx-transaction
service. Then developers should be able to add changes to the transaction's transaction log. After some changes are added developers should be able to retrieve updated data source state, including all changes in the transaction log; update the data source when needed; reset all the changes in the transaction log; perform undo and redo actions.
Here is what will happen with transaction state when new change is added:
- Add change type - when adding such a change one should not provide Initial Value. After successfully adding of such change it will be reflected in aggregated state like Added type. If such a change is then added with Deleted change type it will be removed from aggregated state. Adding of Add change type with id which already exists in aggregated state will throw an exception;
- Update change type - when adding such a change one should provide Initial Value. After successfully adding of such change it will be reflected in aggregated state like Updated type. One can also update Added type, this will be reflected in aggregated state like Added type, and Updated type, this will remain like Updated type in aggregated state. If one tries to update Deleted type an exception will be thrown.
- Delete change type - when adding such a change one should provide Initial Value. After successfully adding of such change it will be reflected in aggregated state like Deleted type. One can also delete Added type, this will remove the record from the aggregated state, and Updated type, this will change the aggregated type to Deleted. If one tries to delete Deleted type an exception will be thrown.
Here is visual representation of all possible add change paths.
3.3. API
ITransaction
Name | Description | Parameters |
---|---|---|
add | Adds a change to the transaction's transaction log | change |
get | Gets the respective change according to provided id | id |
getAll | Gets all the changes from the transaction log | - |
undo | Remove the last change from the transaction log | - |
redo | Adds the last undone change to the transaction log | - |
currentState | Gets the current state of the changed data | - |
update | Commits all the changes to the data source | data |
reset | Clears all the changes from the transaction log | - |
There are no any assumptions or limitations.