Updatehub is an enterprise-grade solution for Software and Firmware Update Over The Air. The update packages are always compressed to improve network usage and multiple different formats of compression are supported. The Updatehub Agent is the application that runs on the embedded device to install the updates, hence having to deal frequently with uncompressing packages.

Initial version of compress-tools was aimed at better defined the API we would need to provided in order to use it on Updatehub as well as to test a hole execution cycle of the Updatehub Agent implementation we had at the time. To avoid complexity we started a initial implementation that instead of using the libarchive library, just did the objects uncompressing using shell commands under the hood. After testing with disk space and memory usage we had defined three main functions that would need to be implemented by the compress-tools in order to have it fully meet our needs:

compress-tools function’s prototypes

The functions should all be able to handle a generic reference to a std::io::Read , so the compressed data can come straight from memory, from a buffered OS file read, or even a special read object that can support timeouts to handle possible disk fails that are fairly common with flash memory devices as provided by the timeout-readwrite crate.