Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
AbnerZheng committed May 14, 2024
1 parent 797ff55 commit 393cac6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mini-lsm-starter/src/mem_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::ops::Bound;
use std::path::Path;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use anyhow::Result;
Expand All @@ -12,6 +12,7 @@ use ouroboros::self_referencing;

use crate::iterators::StorageIterator;
use crate::key::KeySlice;
use crate::table::bloom::BitSlice;
use crate::table::SsTableBuilder;
use crate::wal::Wal;

Expand Down Expand Up @@ -84,6 +85,8 @@ impl MemTable {
pub fn put(&self, key: &[u8], value: &[u8]) -> Result<()> {
self.map
.insert(Bytes::copy_from_slice(key), Bytes::copy_from_slice(value));
self.approximate_size
.fetch_add(key.len() + value.len(), Ordering::Relaxed);
Ok(())
}

Expand Down

0 comments on commit 393cac6

Please sign in to comment.