Create the tasks table in chamberfile #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We could use a separate table to list down the things that we want to do and then write a system to read from that table and execute those tasks (more or less like background job management system) in a typical HTTP-based backend for a web service.
Usecase and Benefit:
For any operation that runs for long and requires to perform a series of operations which take time. For example, validation or verification of contents, re-encrypting the contents for a new key/password, copying large number of files in any direction etc. And can potentially demand a lot of storage for the action as well, breaking the entire operation into smaller tasks and keeping track of those will be much easier as well as safer!
It would also allow us to defer the execution of one long running operation after another and help in achieving the end goal faster and more reliably.
Let's say we are trying to perform the following operations:
How having a
taskstable would helpImagine running these three operations at the same time. What are the challenges?
Keeping track of each operation on each file
We have to make sure that all the old files have been re-encrypted and if there were new files created as a result of copy-in operation, they would have to be encrypted with the new key only (but we have to guarantee that the old password still works, till the re-encrypt is not done). This is complicated to track. You can employ any number of strategies to deal with this - including a record-keeping table for each such operation, or a flag in either the
file_blobstable or thefsindextable or anything else - but the complexity for such an operation will remain high. Sequencing these long running operations by breaking them into smaller tasks that can be done in a sequence helps avoid the complexity and improves the reliability.Total time taken would be lesser
The storage media is a SQLite file (a single one for now, until #7 gets completed, at least). If you try to parallelize so many read and writes, there are at least 3 factors that kick in:
If we have a
taskstable which contains a sequential breakdown of what we intend to do (the above mentioned 3 operations), then the total effort would get simplified (e.g. less number of locks and checks, less load on the OS as well as the media storage).Conclusion backing the decision
Given all the possible scenarios, usecases and environments that Chamber might be executing under, it would serve us better to have a tasks table and use it for longer operations.
NOTE: We will not work on this for the alpha release.