Skip to content

Commit

Permalink
Support writing to not only 3/7 protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklan committed Feb 12, 2025
1 parent eedfd47 commit edf591a
Show file tree
Hide file tree
Showing 2 changed files with 437 additions and 384 deletions.
27 changes: 18 additions & 9 deletions kernel/src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,26 @@ impl Protocol {
/// support the specified protocol writer version and all enabled writer features?
pub fn ensure_write_supported(&self) -> DeltaResult<()> {
match &self.writer_features {
// if min_reader_version = 3 and min_writer_version = 7 and all writer features are
// supported => OK
Some(writer_features)
if self.min_reader_version == 3 && self.min_writer_version == 7 =>
{
Some(writer_features) if self.min_writer_version == 7 => {
// if we're on version 7, make sure we support all the specified features
ensure_supported_features(writer_features, &SUPPORTED_WRITER_FEATURES)
}
// otherwise not supported
_ => Err(Error::unsupported(
"Only tables with min reader version 3 and min writer version 7 with no table features are supported."
)),
Some(_) => {
// there are features, but we're not on 7, so the protocol is actually broken
Err(Error::unsupported(
"Tables with min writer version != 7 should not have table features.",
))
}
None => {
// no features, just ensure we're then not on version 7
require!(
self.min_writer_version != 7,
Error::invalid_protocol(
"If min_writer_version == 7, writer_features _must_ be present"
)
);
Ok(())
}
}
}
}
Expand Down
Loading

0 comments on commit edf591a

Please sign in to comment.