Goal

Last week I got started with a simple chunk repository implementation. It stores chunks in a directory on the local file system. I got as far as implementing a Rust type for this. Today, I will expose the chunk store at the command line.

Plan

  • Implement a command obnam store init DIR to initialize a directory as chunk storage.
  • Implement a command obnam store is DIR to check if a directory is initialized as chunk storage.
  • Implement a command obnam store list DIR to list IDs of all chunks in chunk storage.
  • Implement a command obnam store add DIR ID LABEL to add a chunk to storage.
  • Implement a command obnam store find DIR LABEL to find IDs of chunks with a specific label.
  • Implement a command obnam store path DIR ID to show the fully qualified path name of a chunk given its ID.
  • Implement a command obnam store remove DIR ID to remove a chunk.
  • All of this with Subplot verification scenarios.

I might not get all of this done in one sitting, but if not, I'll continue next time.

Notes

Prelude

  • Verify that tests still pass. They don't. Mysterious problems, with panics on source code lines that don't do anything that would panic.
  • I've seen this before. I set CARGO_TARGET_DIR to a location shared by all my Rust projects. It seems that cargo gets somehow confused when too many projects' output goes into the same target directory.
  • Ran cargo clean and then the tests again, and they passed.
  • Good, I am ready to start work.

Implementation

  • I'd forgotten to add a way to open an existing chunk store. Oops.
  • Added a way to create an Id from &str, for command line parsing.
  • Other than that, quite straightforward.

Rebase and marge

  • Tided up the branch commit history and merged.

Summary

Finished all the commands, well ahead of time. Nice.

I could use the time I have left for today to add support for the chunk store to the obnam chunk subcommands, so that one could, optionally, refer to chunks in the store by ID. However, I suspect that would run over time again, so I won't do that today. There's always next time.

Comments?

If you have feedback on this development session, please use the following fediverse thread: https://toot.liw.fi/@liw/114567287539257837,