I have a system which upon request does things such as
extracts zip, creates directories, inserts database information
It could fail for whatever reason at any stage, maybe permissions, bad file format, database error.
I don’t want the system to have partial executions due to any exceptions.
How exactly would I implement a rollback system ?
What I’m thinking is for every action push into a stack or database a string function execution of the opposite action and for any failure pop it and do an eval on it.
Any other built in way or any tips before I start this?
I run this some situation, best I could to figure is to make verfications during the process(extract zip code, test database connection, verfier the user name avaialble, and so on), in the end of process I apply all the nessery functions(submit data, register user …).