Skip to content

Commit 8859206

Browse files
authored
chore: rename "effect info" to "target states info" for clarity (#1725)
1 parent d03ad32 commit 8859206

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

rust/core/src/engine/execution.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,24 +420,24 @@ impl<'a, Prof: EngineProfile> Committer<'a, Prof> {
420420
fn commit(
421421
&mut self,
422422
child_path_set: Option<ChildStablePathSet>,
423-
effect_info_key: &db_schema::DbEntryKey,
423+
target_state_info_key: &db_schema::DbEntryKey,
424424
all_memo_fps: &HashSet<Fingerprint>,
425425
memos_without_mounts_to_store: Vec<(Fingerprint, FnCallMemo<Prof>)>,
426426
curr_version: Option<u64>,
427427
) -> Result<()> {
428-
let encoded_effect_info_key = effect_info_key.encode()?;
428+
let encoded_target_state_info_key = target_state_info_key.encode()?;
429429
let db_env = self.component_ctx.app_ctx().env().db_env();
430430
{
431431
let mut wtxn = db_env.write_txn()?;
432432
if self.component_ctx.mode() == ComponentProcessingMode::Delete {
433433
self.db
434-
.delete(&mut wtxn, encoded_effect_info_key.as_ref())?;
434+
.delete(&mut wtxn, encoded_target_state_info_key.as_ref())?;
435435
} else {
436436
let curr_version = curr_version
437437
.ok_or_else(|| internal_error!("curr_version is required for Build mode"))?;
438438
let mut tracking_info: db_schema::StablePathEntryTrackingInfo = self
439439
.db
440-
.get(&wtxn, encoded_effect_info_key.as_ref())?
440+
.get(&wtxn, encoded_target_state_info_key.as_ref())?
441441
.map(|data| from_msgpack_slice(&data))
442442
.transpose()?
443443
.ok_or_else(|| internal_error!("tracking info not found for commit"))?;
@@ -467,7 +467,7 @@ impl<'a, Prof: EngineProfile> Committer<'a, Prof> {
467467
let data_bytes = rmp_serde::to_vec_named(&tracking_info)?;
468468
self.db.put(
469469
&mut wtxn,
470-
encoded_effect_info_key.as_ref(),
470+
encoded_target_state_info_key.as_ref(),
471471
data_bytes.as_slice(),
472472
)?;
473473
}
@@ -820,7 +820,7 @@ pub(crate) async fn submit<Prof: EngineProfile>(
820820
let db_env = comp_ctx.app_ctx().env().db_env();
821821
let db = comp_ctx.app_ctx().db();
822822

823-
let effect_info_key = db_schema::DbEntryKey::StablePath(
823+
let target_state_info_key = db_schema::DbEntryKey::StablePath(
824824
comp_ctx.stable_path().clone(),
825825
db_schema::StablePathEntryKey::TrackingInfo,
826826
);
@@ -866,7 +866,7 @@ pub(crate) async fn submit<Prof: EngineProfile>(
866866
}
867867

868868
let mut tracking_info: Option<db_schema::StablePathEntryTrackingInfo> = db
869-
.get(&wtxn, effect_info_key.encode()?.as_ref())?
869+
.get(&wtxn, target_state_info_key.encode()?.as_ref())?
870870
.map(|data| from_msgpack_slice(&data))
871871
.transpose()?;
872872
let previously_exists = tracking_info.is_some();
@@ -962,9 +962,9 @@ pub(crate) async fn submit<Prof: EngineProfile>(
962962
.transpose()?
963963
{
964964
Some(s) => {
965-
db_schema::EffectInfoItemState::Existing(Cow::Owned(s.into()))
965+
db_schema::TargetStateInfoItemState::Existing(Cow::Owned(s.into()))
966966
}
967-
None => db_schema::EffectInfoItemState::Deleted,
967+
None => db_schema::TargetStateInfoItemState::Deleted,
968968
},
969969
));
970970
} else {
@@ -1008,13 +1008,13 @@ pub(crate) async fn submit<Prof: EngineProfile>(
10081008
else {
10091009
continue;
10101010
};
1011-
let item = db_schema::EffectInfoItem {
1011+
let item = db_schema::TargetStateInfoItem {
10121012
key: Cow::Owned(effect_key_bytes.into()),
10131013
states: vec![
1014-
(0, db_schema::EffectInfoItemState::Deleted),
1014+
(0, db_schema::TargetStateInfoItemState::Deleted),
10151015
(
10161016
curr_version,
1017-
db_schema::EffectInfoItemState::Existing(new_state),
1017+
db_schema::TargetStateInfoItemState::Existing(new_state),
10181018
),
10191019
],
10201020
};
@@ -1024,7 +1024,7 @@ pub(crate) async fn submit<Prof: EngineProfile>(
10241024
let data_bytes = rmp_serde::to_vec_named(&tracking_info)?;
10251025
db.put(
10261026
&mut wtxn,
1027-
effect_info_key.encode()?.as_ref(),
1027+
target_state_info_key.encode()?.as_ref(),
10281028
data_bytes.as_slice(),
10291029
)?;
10301030
Some(curr_version)
@@ -1066,7 +1066,7 @@ pub(crate) async fn submit<Prof: EngineProfile>(
10661066
let mut committer = Committer::new(comp_ctx, &target_states_providers, demote_component_only)?;
10671067
committer.commit(
10681068
child_path_set,
1069-
&effect_info_key,
1069+
&target_state_info_key,
10701070
&finalized_fn_call_memos.all_memos_fps,
10711071
finalized_fn_call_memos.memos_without_mounts_to_store,
10721072
curr_version,

rust/core/src/state/db_schema.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub enum StablePathEntryKey {
2626
FunctionMemoization(Fingerprint),
2727

2828
/// Required.
29-
/// Value type: StablePathEntryEffectInfo
29+
/// Value type: StablePathEntryTargetStateInfo
3030
TrackingInfo,
3131

3232
ChildExistencePrefix,
@@ -205,7 +205,7 @@ pub struct FunctionMemoizationEntry<'a> {
205205

206206
#[serde_as]
207207
#[derive(Serialize, Deserialize, Debug)]
208-
pub enum EffectInfoItemState<'a> {
208+
pub enum TargetStateInfoItemState<'a> {
209209
#[serde(rename = "D")]
210210
Deleted,
211211
#[serde(untagged)]
@@ -216,27 +216,27 @@ pub enum EffectInfoItemState<'a> {
216216
),
217217
}
218218

219-
impl<'a> EffectInfoItemState<'a> {
219+
impl<'a> TargetStateInfoItemState<'a> {
220220
pub fn is_deleted(&self) -> bool {
221-
matches!(self, EffectInfoItemState::Deleted)
221+
matches!(self, TargetStateInfoItemState::Deleted)
222222
}
223223

224224
pub fn as_ref(&self) -> Option<&[u8]> {
225225
match self {
226-
EffectInfoItemState::Deleted => None,
227-
EffectInfoItemState::Existing(s) => Some(s.as_ref()),
226+
TargetStateInfoItemState::Deleted => None,
227+
TargetStateInfoItemState::Existing(s) => Some(s.as_ref()),
228228
}
229229
}
230230
}
231231

232232
#[serde_as]
233233
#[derive(Serialize, Deserialize, Debug)]
234-
pub struct EffectInfoItem<'a> {
234+
pub struct TargetStateInfoItem<'a> {
235235
#[serde_as(as = "Bytes")]
236236
#[serde(rename = "P", borrow)]
237237
pub key: Cow<'a, [u8]>,
238238
#[serde(rename = "S", borrow, default, skip_serializing_if = "Vec::is_empty")]
239-
pub states: Vec<(/*version*/ u64, EffectInfoItemState<'a>)>,
239+
pub states: Vec<(/*version*/ u64, TargetStateInfoItemState<'a>)>,
240240
}
241241

242242
pub const UNKNOWN_PROCESSOR_NAME: &'static str = "<unknown>";
@@ -250,7 +250,7 @@ pub struct StablePathEntryTrackingInfo<'a> {
250250
#[serde(rename = "V")]
251251
pub version: u64,
252252
#[serde(rename = "I", borrow)]
253-
pub effect_items: BTreeMap<TargetStatePath, EffectInfoItem<'a>>,
253+
pub effect_items: BTreeMap<TargetStatePath, TargetStateInfoItem<'a>>,
254254
#[serde(rename = "N", borrow, default = "unknown_processor_name")]
255255
pub processor_name: Cow<'a, str>,
256256
}

0 commit comments

Comments
 (0)