Skip to content

Commit fc4765b

Browse files
ppdoggskyzh
andauthored
Fix wrong input type of put_batch (#146)
* Fix wrong input type of put_batch Update wal.rs * fix Signed-off-by: Alex Chi <[email protected]> --------- Signed-off-by: Alex Chi <[email protected]> Co-authored-by: Alex Chi <[email protected]>
1 parent 4c8d4eb commit fc4765b

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

mini-lsm-starter/src/mem_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl MemTable {
9999
unimplemented!()
100100
}
101101

102-
/// Implement this in week 3, day 5.
102+
/// Implement this in week 3, day 5; if you want to implement this earlier, use `&[u8]` as the key type.
103103
pub fn put_batch(&self, _data: &[(KeySlice, &[u8])]) -> Result<()> {
104104
unimplemented!()
105105
}

mini-lsm-starter/src/wal.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
#![allow(unused_variables)] // TODO(you): remove this lint after implementing this mod
1616
#![allow(dead_code)] // TODO(you): remove this lint after implementing this mod
1717

18+
use anyhow::Result;
19+
use bytes::Bytes;
20+
use crossbeam_skiplist::SkipMap;
21+
use parking_lot::Mutex;
1822
use std::fs::File;
1923
use std::io::BufWriter;
2024
use std::path::Path;
2125
use std::sync::Arc;
2226

23-
use anyhow::Result;
24-
use bytes::Bytes;
25-
use crossbeam_skiplist::SkipMap;
26-
use parking_lot::Mutex;
27+
use crate::key::KeySlice;
2728

2829
pub struct Wal {
2930
file: Arc<Mutex<BufWriter<File>>>,
@@ -42,8 +43,8 @@ impl Wal {
4243
unimplemented!()
4344
}
4445

45-
/// Implement this in week 3, day 5.
46-
pub fn put_batch(&self, _data: &[(&[u8], &[u8])]) -> Result<()> {
46+
/// Implement this in week 3, day 5; if you want to implement this earlier, use `&[u8]` as the key type.
47+
pub fn put_batch(&self, _data: &[(KeySlice, &[u8])]) -> Result<()> {
4748
unimplemented!()
4849
}
4950

mini-lsm/src/mem_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl MemTable {
121121
Ok(())
122122
}
123123

124-
/// Implement this in week 3, day 5.
124+
/// Implement this in week 3, day 5; if you want to implement this earlier, use `&[u8]` as the key type.
125125
pub fn put_batch(&self, _data: &[(KeySlice, &[u8])]) -> Result<()> {
126126
unimplemented!()
127127
}

mini-lsm/src/wal.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ use bytes::{Buf, BufMut, Bytes};
2323
use crossbeam_skiplist::SkipMap;
2424
use parking_lot::Mutex;
2525

26+
use crate::key::KeySlice;
27+
2628
pub struct Wal {
2729
file: Arc<Mutex<BufWriter<File>>>,
2830
}
@@ -93,8 +95,8 @@ impl Wal {
9395
Ok(())
9496
}
9597

96-
/// Implement this in week 3, day 5.
97-
pub fn put_batch(&self, _data: &[(&[u8], &[u8])]) -> Result<()> {
98+
/// Implement this in week 3, day 5; if you want to implement this earlier, use `&[u8]` as the key type.
99+
pub fn put_batch(&self, _data: &[(KeySlice, &[u8])]) -> Result<()> {
98100
unimplemented!()
99101
}
100102

0 commit comments

Comments
 (0)