Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/core/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ pub fn hash_buffer(buffer: impl AsRef<[u8]>) -> String {
///
/// Will return error if unable to access file.
pub fn hash_file(filepath: impl AsRef<Path>) -> Result<String> {
hash_stream(
&mut File::open(&filepath).context(selector::InvalidFilepath {
path: filepath.as_ref(),
})?,
)
hash_stream(&mut File::open(&filepath).context(selector::InvalidPath {
path: filepath.as_ref(),
})?)
}
/// Evaluate checksum hash of a directory.
///
Expand All @@ -64,7 +62,10 @@ pub fn hash_file(filepath: impl AsRef<Path>) -> Result<String> {
pub fn hash_dir(dirpath: impl AsRef<Path>) -> Result<String> {
let summary: BTreeMap<String, String> = dirpath
.as_ref()
.read_dir()?
.read_dir()
.context(selector::InvalidPath {
path: dirpath.as_ref(),
})?
.map(|path| {
let access_path = path?.path();
Ok((
Expand Down
2 changes: 1 addition & 1 deletion src/core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl fmt::Debug for OrcaError {
match &self.kind {
Kind::AgentCommunicationFailure { backtrace, .. }
| Kind::IncompletePacket { backtrace, .. }
| Kind::InvalidFilepath { backtrace, .. }
| Kind::InvalidPath { backtrace, .. }
| Kind::MissingInfo { backtrace, .. }
| Kind::BollardError { backtrace, .. }
| Kind::ChronoParseError { backtrace, .. }
Expand Down
2 changes: 1 addition & 1 deletion src/core/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Operator for JoinOperator {
.filter_map(|(parent_stream, parent_packets)| {
(parent_stream != &stream_name).then_some(parent_packets.clone())
})
.chain(vec![vec![packet.clone()]].into_iter())
.chain(vec![vec![packet.clone()]])
.collect::<Vec<_>>();
drop(received_packets);

Expand Down
2 changes: 1 addition & 1 deletion src/core/store/filestore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl LocalFileStore {
Ok((
serde_yaml::from_str(
&fs::read_to_string(path.clone())
.context(selector::InvalidFilepath { path })?,
.context(selector::InvalidPath { path })?,
)?,
None,
hash.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion src/uniffi/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) enum Kind {
backtrace: Option<Backtrace>,
},
#[snafu(display("{source} ({path:?})."))]
InvalidFilepath {
InvalidPath {
path: PathBuf,
source: io::Error,
backtrace: Option<Backtrace>,
Expand Down
2 changes: 1 addition & 1 deletion src/uniffi/orchestrator/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Orchestrator for LocalDockerOrchestrator {
let location = namespace_lookup[&image_info.namespace].join(&image_info.path);
let byte_stream = FramedRead::new(
File::open(&location)
.context(selector::InvalidFilepath { path: &location })
.context(selector::InvalidPath { path: &location })
.await?,
BytesCodec::new(),
)
Expand Down
1 change: 1 addition & 0 deletions tests/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![expect(missing_docs, clippy::panic_in_result_fn, reason = "OK in tests.")]
pub mod fixture;

use orcapod::{
core::crypto::{hash_buffer, hash_dir, hash_file},
Expand Down
Binary file modified tests/extra/data/output/result2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn pod_job_to_yaml() -> Result<()> {
fn hash_pod_result() -> Result<()> {
assert_eq!(
pod_result_style(&NAMESPACE_LOOKUP_READ_ONLY)?.hash,
"35abb8180349bed1f3ea8c0d84e98000ec3ace904624e94e678783891a7e710e",
"e752d86d4fc5435bfa4564ba951851530f5cf2228586c2f488c2ca9e7bcc7ed1",
"Hash didn't match."
);
Ok(())
Expand All @@ -129,7 +129,7 @@ fn pod_result_to_yaml() -> Result<()> {
location:
namespace: default
path: output/result2.jpeg
checksum: da71a1b5f8ca6ebd1edfd11df4c83078fc50d0e6a4c9b3d642ba397d81d8e883
checksum: a1458fc7d7d9d23a66feae88b5a89f1756055bdbb6be02fdf672f7d31ed92735
assigned_name: simple-endeavour
status: Completed
created: 1737922307
Expand Down