Goal
- Today I'm going to refactor the Obnam client code base so that things needed by several subcommands are convenient to do.
Plan
I'll introduce an internal type or abstraction to set up a cipher engine using a specific key and encrypt and decrypt chunks with that.
I'll introduce a helper function or type to upload chunks to a repository. Later, this will be a convenient place to do deduplication.
I'll introduce a label factory, to create well-known fixed labels. Currently the textual form of labels are just string literals and there's a chance they'll diverge.
I'll reconsider how error types are structured and maybe make changes.
Notes
Test suite passes, good.
I'm slightly bothered by the fact that well-known labels for specific kinds of chunks are not constants, but not enough to do something about that. I don't expect there will be enough of them to matter for performance. I should measure that when Obnam can make real backups, and if there's a need, I'll refactor then.
Added a
LabelFactorythat knows how to build all the well-known labels. For now it creates a fixed label for data chunks, but that will change when I implement chunk deduplication.Looking at refactoring how to set up cipher engines, I realize there's a bunch of context needed for doing that. I'll add a type to hold that context, for convenience.
Added
ClientContext. I'm generally not in favor of such vague types, or calling them contexts, but in this case it seems to allow me to reduce code duplication a lot. I hope this is worth it. This also has methods to split files into chunks and uploading chunks to the repository.I failed to add code to
ClientContextto sniff out the client key from credentials, and this prevented me from using it in all subcommands. I've opened issues about that. I'll fix it later.Merged.
Summary
- Made reasonable progress in refactoring to simplify overall codebase. More remains to do, but that is life in software development.
Support?
If you'd like to fund Obnam development, see my funding page. My high level goal is described on the architecture page. What is most important about backup software to you?