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

chore: rename StaticLeveledMap to StaticLevels; refactor Marked::new_xxx() #13114

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/meta/raft-store/src/sm_v002/leveled_store/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl MapApi<String> for Level {

let marked = if let Some((v, meta)) = value {
let seq = self.sys_data_mut().next_seq();
Marked::new_normal(seq, v, meta)
Marked::new_with_meta(seq, v, meta)
} else {
// Do not increase the sequence number, just use the max seq for all tombstone.
let seq = self.curr_seq();
Expand Down
15 changes: 7 additions & 8 deletions src/meta/raft-store/src/sm_v002/leveled_store/leveled_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::sm_v002::leveled_store::map_api::MapApiRO;
use crate::sm_v002::leveled_store::map_api::MapKey;
use crate::sm_v002::leveled_store::ref_::Ref;
use crate::sm_v002::leveled_store::ref_mut::RefMut;
use crate::sm_v002::leveled_store::static_leveled_map::StaticLeveledMap;
use crate::sm_v002::leveled_store::static_levels::StaticLevels;
use crate::sm_v002::marked::Marked;

/// State machine data organized in multiple levels.
Expand All @@ -42,9 +42,8 @@ pub struct LeveledMap {
/// The top level is the newest and writable.
writable: Level,

/// The immutable levels, from the oldest to the newest.
/// levels[0] is the bottom and oldest level.
frozen: StaticLeveledMap,
/// The immutable levels.
frozen: StaticLevels,
}

impl LeveledMap {
Expand All @@ -62,8 +61,8 @@ impl LeveledMap {
.chain(self.frozen.iter_levels())
}

/// Freeze the current writable level and create a new writable level.
pub fn freeze_writable(&mut self) -> &StaticLeveledMap {
/// Freeze the current writable level and create a new empty writable level.
pub fn freeze_writable(&mut self) -> &StaticLevels {
let new_writable = self.writable.new_level();

let frozen = std::mem::replace(&mut self.writable, new_writable);
Expand All @@ -83,12 +82,12 @@ impl LeveledMap {
}

/// Return a reference to the immutable levels.
pub fn frozen_ref(&self) -> &StaticLeveledMap {
pub fn frozen_ref(&self) -> &StaticLevels {
&self.frozen
}

/// Replace all immutable levels with the given one.
pub(crate) fn replace_frozen_levels(&mut self, b: StaticLeveledMap) {
pub(crate) fn replace_frozen(&mut self, b: StaticLevels) {
self.frozen = b;
}

Expand Down
Loading
Loading