Skip to content

Commit

Permalink
FIX: Make AsyncRecordDecoder cancel-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Nov 15, 2023
1 parent 05f9283 commit aedc391
Show file tree
Hide file tree
Showing 12 changed files with 463 additions and 118 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
the latest version
- Added `-u`/`--upgrade` flags to `dbn` CLI that when passed upgrades DBN data from
previous versions. By default data is decoded as-is
- Made `AsyncDbnDecoder::decode_record`, `AsyncDbnDecoder::decode_record_ref`,
`dbn::AsyncRecordDecoder::decode`, and `dbn::AsyncRecordDecoder::decode_ref`
cancellation safe. This makes them safe to use within a
`tokio::select!`(https://docs.rs/tokio/latest/tokio/macro.select.html) statement
- Added documention around cancellation safety for async APIs
- Added `TOB` flag to denote top-of-book messages
- Added new publisher values in preparation for IFEU.IMPACT and NDEX.IMPACT datasets
- Added new publisher values for consolidated DBEQ.BASIC and DBEQ.PLUS
Expand Down
2 changes: 1 addition & 1 deletion rust/dbn-cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn read_from_nonexistent_path() {
])
.assert()
.failure()
.stderr(contains("Error opening file to decode"));
.stderr(contains("while opening file to decode"));
}

#[rstest]
Expand Down
8 changes: 4 additions & 4 deletions rust/dbn/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ where
)?,
)))
} else {
Err(crate::Error::decode("Unable to determine encoding"))
Err(crate::Error::decode("unable to determine encoding"))
}
}
}
Expand All @@ -227,7 +227,7 @@ impl<'a> DynDecoder<'a, BufReader<File>> {
crate::Error::io(
e,
format!(
"Error opening file to decode at path '{}'",
"opening file to decode at path '{}'",
path.as_ref().display()
),
)
Expand Down Expand Up @@ -382,7 +382,7 @@ impl<'a> DynReader<'a, BufReader<File>> {
crate::Error::io(
e,
format!(
"Error opening file to decode at path '{}'",
"opening file to decode at path '{}'",
path.as_ref().display()
),
)
Expand Down Expand Up @@ -505,7 +505,7 @@ mod tests {
let res = DynDecoder::new_inferred(io::Cursor::new(buf), VersionUpgradePolicy::default());
assert!(matches!(res, Err(e) if e
.to_string()
.contains("Can't decode newer version of DBN")));
.contains("can't decode newer version of DBN")));
}
}

Expand Down
Loading

0 comments on commit aedc391

Please sign in to comment.