Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Compute a restore proc from a backup proc string #8

Open
Roman2K opened this issue Mar 17, 2017 · 1 comment
Open

Compute a restore proc from a backup proc string #8

Roman2K opened this issue Mar 17, 2017 · 1 comment

Comments

@Roman2K
Copy link
Owner

Roman2K commented Mar 17, 2017

Suggestion by @lavalamp originally posted in the defunct GitLab repo (old issue)

I realize there's no way to know the inverse of a user-specified command, but it would be pretty handy to at least know where I ought to plug it in :)

@Roman2K
Copy link
Owner Author

Roman2K commented Mar 17, 2017

My response:

Actually, automatically computing the reverse chain is what I had in mind originally 🙈 But as I added new procs, I realized there were too many discrepancies from one to the other to to be able to easily compose a reverse chain from the reverse version of each proc (unproc) because there can exist differences between proc and unproc, such as:

  • different arguments (ex: index takes a path, uindex no)
  • different requirements (ex: uparity requires checksum + group, parity no)
  • and most blocking... the requirements of a proc may come from different sources, forcing to make assumptions as to which proc to use to meet the requirements (ex: checksum for uparity -> can come from uindex or checksum)

Instead of introducing potential brittleness, I felt I would be more confident in the restore process if the restore script was written just as explicitly as the backup script.

it would be pretty handy to at least know where I ought to plug it in :)

If you were to start working on such a feature, I suggest you start from listing the types returned by ArgLambdas in argproc (the proc string parser). And for each, implement an unprocer interface (defines Unproc() (Proc, error)) that returns the reverse Proc. You would implement it in procs.Chain too, which would return the unproc of the procs composing it, in reverse order. All of them must implement Unprocer, otherwise return an error. This way, reversing a chain containing chains works too. But then you have to check the requirements are met. So each proc would define a list of what they do (assign checksum, group chunks, etc.) and it becomes... a tangled mess... At least I don't yet have a clear vision of how to do it in a maintainable manner 😅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant