Skip to content
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

Should function signatures be consistent between mini-lsm-starter and mini-lsm? #72

Open
Gleiphir2769 opened this issue Apr 13, 2024 · 1 comment

Comments

@Gleiphir2769
Copy link
Contributor

Hi, I noticed that some function signatures is different beween mini-lsm-starter and mini-lsm.

For example, decode_block_meta in mini-lsm-starter

/// Decode block meta from a buffer.
pub fn decode_block_meta(buf: impl Buf) -> Vec<BlockMeta> {
unimplemented!()

decode_block_meta in mini-lsm

pub fn decode_block_meta(mut buf: &[u8]) -> Result<Vec<BlockMeta>> {
let mut block_meta = Vec::new();
let num = buf.get_u32() as usize;

According to the commit history, it seems that decode_block_meta in mini-lsm was later modified, causing the function signature to change. I found many similar situations while reading the code.

Does it need to be fixed? If it is, let me know and I can help to fix them.

@skyzh
Copy link
Owner

skyzh commented Apr 14, 2024

&[u8] implements Buf and I believe the interface is fully compatible. Both ways should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants