Goal
I wasn't able to develop Obnam 3 last week, so this week I'm doing a session on Saturday.
Last time I implement subcommands for managing a chunk store. This
time I'll integrate the chunk store to obnam chunk
subcommands.
Plan
- Add a global option
obnam --chunks DIR
that sets chunk store location. - Change
obnam store
commands to use the location set with the global option. Remove any location arguments from subcommands. - Change
obnam chunk encode
to use the global chunk store location, if an explicit filename isn't set. - Likewise
obnam chunk decrypt
. - Likewise
obnam chunk inspect
.
Notes
Prelude
- Verify that tests still pass. They do.
Add global --repository
option
On reflection,
--chunks
isn't a particularly clean option name, from a user point of view. It requires understanding that backups are stored as chunks. I'll use the option--repository
instead. Since that is a long option name, I'll allow the alias-r
as well.Added the option.
Changed the
obnam store
subcommands to use the store location set with the option. Some day will want to add a configuration file that can set this, but one change at a time.For the
obnam chunk
subcommands I'll want to continue to support using chunks without using the chunk store. However, I'll want to make using the store the default.For
obnam chunk encrypt
there is already an--output
option. If that's not used, fall back to using the chunk store. This means the command will lose the possibility of writing to the standard output. I can add that back later if there's a need.For
obnam chunk decrypt
the chunk file is named on the command line. I'll change the subcommand to require either an option--id
to specify the ID of a chunk in the chunk store, or--filename
to specify a filename.Likewise for
obnam chunk inspect
.For testing this I will need to capture the chunk id in some way so that a later step can refer to it. Given how primitive the Subplot libraries for capturing output is, I'll want to avoid that. Instead, I'll add an option
--id
toobnam chunk encrypt
that sets the ID. By default it picks a random one.OK, after uninteresting side steps got this working.
Refactored code to reduce duplication by adding some helper functions the the
Leaf
trait to get or open the chunk repository.
Tidy up
- Removed various
eprintln
calls for debugging and other cruft left in the coded base. - Verified that CI is happy.
- Merged.
Summary
I reached my goal, and now obnam
make use of the repository more
convenient.
Comments?
If you have feedback on this development session, please use the following fediverse thread: https://toot.liw.fi/@liw/114641233721923242.