-
Notifications
You must be signed in to change notification settings - Fork 98
fix: make wal-protocol compile with no features #3137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make wal-protocol compile with no features #3137
Conversation
I think after this PR, all crates will compile with each features and no-default-features. We should find an automated way to detect these compilation failure issues. |
@tillrohrmann ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning things up @lsytj0413. The change looks good to me. We might be able to make things a bit more cleaner by moving the append_envelope_to_bifrost
to the bifrost
crate. Then we can remove the circular dependency from restate-wal-protocol
and avoid the cfg feature.
crates/wal-protocol/src/lib.rs
Outdated
@@ -246,6 +250,7 @@ pub enum Error { | |||
/// todo: This method should be removed in favor of using Appender/BackgroundAppender API in | |||
/// Bifrost. Additionally, the check for partition_table is probably unnecessary in the vast | |||
/// majority of call-sites. | |||
#[cfg(feature = "serde")] | |||
pub async fn append_envelope_to_bifrost( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this method to the bifrost
crate? Then we can get rid of the circular dependency and the cfg feature here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tillrohrmann fixed, ptal. (i didn't have permissions to add reviewer
crates/wal-protocol/src/lib.rs
Outdated
@@ -225,6 +228,7 @@ impl MatchKeyQuery for Envelope { | |||
} | |||
} | |||
|
|||
#[cfg(feature = "serde")] | |||
#[derive(Debug, thiserror::Error)] | |||
pub enum Error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error type would move to the bifrost
crate as well then.
cfa5f24
to
3176ce6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for updating the PR and removing the bifrost
dependency from the wal-protocol
crate. This is a really good clean up. I'll address my last comments while merging this PR.
crates/bifrost/src/error.rs
Outdated
#[error("partition not found: {0}")] | ||
PartitionNotFound(#[from] PartitionTableError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would create a new AppendError
that has this and Error
as a variant to not infect Error
with the partition lookup error.
crates/wal-protocol/src/lib.rs
Outdated
#[cfg(feature = "serde")] | ||
pub fn to_bytes(&self) -> Result<Bytes, StorageEncodeError> { | ||
let mut buf = BytesMut::default(); | ||
StorageCodec::encode(self, &mut buf)?; | ||
Ok(buf.freeze()) | ||
} | ||
|
||
#[cfg(feature = "serde")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can have a dedicated impl block that is feature gated together with the imports. That way the bits of the serde
feature are kept closer together.
3176ce6
to
d0b2ca4
Compare
Fix: #3036
before fix: