Skip to content

Commit

Permalink
Merge branch 'main' into rkuris/shale-cleanup-project-2
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Pringle <richard.pringle@avalabs.org>
  • Loading branch information
richardpringle authored Oct 30, 2023
2 parents dad3b16 + 1bafa21 commit bba5ea6
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions shale/src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,47 +213,6 @@ impl Storable for CompactSpaceHeader {
}
}

struct ObjPtrField(DiskAddress);

impl ObjPtrField {
const MSIZE: u64 = 8;
}

impl Storable for ObjPtrField {
fn hydrate<U: CachedStore>(addr: usize, mem: &U) -> Result<Self, ShaleError> {
let raw = mem
.get_view(addr, Self::MSIZE)
.ok_or(ShaleError::InvalidCacheView {
offset: addr,
size: Self::MSIZE,
})?;
let obj_ptr = raw.as_deref()[0..8].into();
Ok(Self(obj_ptr))
}

fn dehydrate(&self, to: &mut [u8]) -> Result<(), ShaleError> {
Cursor::new(to).write_all(&self.to_le_bytes())?;
Ok(())
}

fn dehydrated_len(&self) -> u64 {
Self::MSIZE
}
}

impl std::ops::Deref for ObjPtrField {
type Target = DiskAddress;
fn deref(&self) -> &DiskAddress {
&self.0
}
}

impl std::ops::DerefMut for ObjPtrField {
fn deref_mut(&mut self) -> &mut DiskAddress {
&mut self.0
}
}

#[derive(Debug)]
struct CompactSpaceInner<M> {
meta_space: Arc<M>,
Expand Down

0 comments on commit bba5ea6

Please sign in to comment.