-
Notifications
You must be signed in to change notification settings - Fork 77
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 #263 #264
fix #263 #264
Conversation
Codecov Report
@@ Coverage Diff @@
## master #264 +/- ##
==========================================
+ Coverage 51.80% 51.92% +0.11%
==========================================
Files 72 73 +1
Lines 12265 12264 -1
==========================================
+ Hits 6354 6368 +14
+ Misses 5911 5896 -15
|
Current implementation in #[inline]
fn chunk_mut(&mut self) -> &mut UninitSlice {
if self.capacity() == self.len() {
self.reserve(64);
}
UninitSlice::from_slice(self.spare_capacity_mut())
} So we do rely on this specific implementation of |
The unsafe impl BufMut for Vec<u8> {
#[inline]
fn chunk_mut(&mut self) -> &mut UninitSlice {
if self.capacity() == self.len() {
self.reserve(64); // Grow the vec
}
let cap = self.capacity();
let len = self.len();
let ptr = self.as_mut_ptr();
unsafe { &mut UninitSlice::from_raw_parts_mut(ptr, cap)[len..] }
}
} A |
Since we refactored the code to use bytes crate, the |
…the buffer is uninitialized
fix #263
Please briefly answer these questions:
what problem are you trying to solve? (or if there's no problem, what's the motivation for this change?)
improve the read and write logic for the RocksSnapshot
what changes does this pull request make?
change of SnapshotApi in read_exact and write_all funtions and all associated calls on these funtions
are there any non-obvious implications of these changes? (does it break compatibility with previous versions, etc)
read_exact and write_all funtions now use bytes::{Bytes, BytesMut} as parameter types