Conversation
RMPR
left a comment
There was a problem hiding this comment.
Looks very nice! If you rebase you should be able to build on Windows.
I am not a big fan of the last commit as it most likely breaks the build on Windows, but we will see what the CI says.
Test tests wouldn't compile because of wrong array size.
This started out as a shell script, but add a very simple Rust wrapper in order to be able to call it as `cargo test`. Rewrite later.
With the extra InvalidAddress variant the Runtime variant does not need an optional source error inside it. This makes lager::Error interact more nicely with anyhow. Leverage the #[from] attribute of thiserror to simplify errors from dependent libraries.
Error propagation because easier and main() easier to read.
Comparted to the previous implementation of cache_hit() this one attempts to retrieve both the header and object before doing any error handling. In the happy path we end up calling both anyway so that's not an issue. It might not be a good ideea in the future to let cache failures be fatal like this, but it helps with development.
The last, really? Do you actually mean the system test commit? Or perhaps the workspace one? I have no issue removing either one. |
Yup, the one that introduces the unix specific extensions https://github.com/zivid/halide-cache/actions/runs/23163614443/job/67370342216?pr=1 Now that we have CI that actually works. |
halide-cache/src/main.rs
Outdated
| use clap::Parser; | ||
| use lager::{Address, LRU, Lager}; | ||
| use named_lock::NamedLock; | ||
| use std::os::unix::ffi::OsStrExt; |
There was a problem hiding this comment.
I didn't notice it. Using as_encoded_bytes() is good enough for this usecase. No OS-specific traits needed.
Instead of converting things to vector of strings and so on, make a simple struct to store the dependency info. Add `make_address()` to that struct to generate the required address directly. We now hash the data directly instead of doing hashes of hashes. Additionally, generate the 64 bytes directly.
Add top-level Cargo.toml defining workspace
Run cargo fmt
lager: Fix tests
Test tests wouldn't compile because of wrong array size.
halide-cache: Add crude system test
This started out as a shell script, but add a very simple Rust wrapper
in order to be able to call it as
cargo test. Rewrite later.lager: Make additional error variant and simplify
With the extra InvalidAddress variant the Runtime variant does not need
an optional source error inside it. This makes lager::Error interact
more nicely with anyhow.
Leverage the #[from] attribute of thiserror to simplify errors from
dependent libraries.
halide-cache: Use anyhow for top-level errors
Error propagation because easier and main() easier to read.
halide-cache: Be stricter about cache errors
Comparted to the previous implementation of cache_hit() this one
attempts to retrieve both the header and object before doing any error
handling. In the happy path we end up calling both anyway so that's not
an issue.
It might not be a good ideea in the future to let cache failures be
fatal like this, but it helps with development.
halide-cache: Collect dependencies in a struct
Instead of converting things to vector of strings and so on, make a
simple struct to store the dependency info. Add
make_address()to thatstruct to generate the required address directly. We now hash the data
directly instead of doing hashes of hashes.
Additionally, generate the 64 bytes directly.