You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "codope (via GitHub)" <gi...@apache.org> on 2025/09/02 07:15:19 UTC
Re: [PR] feat: add LSM timeline support with timeline layout management for old and new table versions [hudi-rs]
codope commented on code in PR #395:
URL: https://github.com/apache/hudi-rs/pull/395#discussion_r2315143086
##########
crates/core/src/timeline/mod.rs:
##########
@@ -54,75 +61,70 @@ pub const DEFAULT_LOADING_ACTIONS: &[Action] =
&[Action::Commit, Action::DeltaCommit, Action::ReplaceCommit];
impl Timeline {
- #[cfg(test)]
- pub(crate) async fn new_from_completed_commits(
+ pub(crate) fn new(
hudi_configs: Arc<HudiConfigs>,
- storage_options: Arc<HashMap<String, String>>,
- completed_commits: Vec<Instant>,
- ) -> Result<Self> {
- let storage = Storage::new(storage_options.clone(), hudi_configs.clone())?;
- Ok(Self {
+ storage: Arc<Storage>,
+ active_loader: TimelineLoader,
+ archived_loader: Option<TimelineLoader>,
+ ) -> Self {
+ Self {
hudi_configs,
storage,
- completed_commits,
- })
+ active_loader,
+ archived_loader,
+ completed_commits: Vec::new(),
+ }
}
pub(crate) async fn new_from_storage(
hudi_configs: Arc<HudiConfigs>,
storage_options: Arc<HashMap<String, String>>,
) -> Result<Self> {
let storage = Storage::new(storage_options.clone(), hudi_configs.clone())?;
+ let mut timeline = TimelineBuilder::new(hudi_configs, storage).build().await?;
let selector = TimelineSelector::completed_actions_in_range(
DEFAULT_LOADING_ACTIONS,
- hudi_configs.clone(),
+ timeline.hudi_configs.clone(),
None,
None,
)?;
- let completed_commits = Self::load_instants(&selector, &storage, false).await?;
- Ok(Self {
- hudi_configs,
- storage,
- completed_commits,
- })
+ timeline.completed_commits = timeline.load_instants(&selector, false).await?;
+ Ok(timeline)
+ }
+
+ pub async fn load_instants(
+ &self,
+ selector: &TimelineSelector,
+ desc: bool,
+ ) -> Result<Vec<Instant>> {
+ self.active_loader.load_instants(selector, desc).await
}
- async fn load_instants(
+ pub async fn load_instants_with_archive(
+ &self,
selector: &TimelineSelector,
- storage: &Storage,
desc: bool,
+ include_archived: bool,
Review Comment:
Agreed. We’ll keep public API simple and make archived loading an internal concern driven by the selector range; removed the public flag for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org