Expand description
Read a contiguous range of raw Delta commits.
A CommitRange holds an inclusive [start_version, end_version] range and the list of
commit files; reads are lazy (no JSON I/O until CommitRange::commits is called).
Two construction paths, differing only in how _delta_log/ is listed at build time:
CommitRange::builder_for: lists_delta_log/for the requested range.CommitRange::builder_from: reuses an existing snapshot’sLogSegment, avoiding the listing.
CommitRange::commits takes a list of DeltaAction
and an optional start_snapshot. When the snapshot is supplied, the iterator seeds its
latest_protocol / latest_metadata from it and the snapshot’s version must match the
range’s start_version (in ascending order) or end_version (in descending order). When
the snapshot is None, validation is purely commit-driven. See CommitRange::commits
for protocol-validation details.
§Example
use std::sync::Arc;
use delta_kernel::commit_range::{CommitRange, DeltaAction};
use delta_kernel::{Engine, Error, Snapshot};
use delta_kernel::object_store::local::LocalFileSystem;
use test_utils::delta_kernel_default_engine::DefaultEngineBuilder;
let engine: Arc<dyn Engine> =
Arc::new(DefaultEngineBuilder::new(Arc::new(LocalFileSystem::new())).build());
let start_snapshot = Snapshot::builder_for("file:///data/T").at_version(0).build(engine.as_ref())?;
let range = CommitRange::builder_for("file:///data/T", 0)
.with_end_version(4)
.build(engine.as_ref())?;
for commit in range.commits(
engine.clone(),
Some(start_snapshot),
&[DeltaAction::Add, DeltaAction::Remove],
)? {
let commit = commit?;
println!("v={} ts={}", commit.version(), commit.timestamp());
for batch in commit.get_actions(engine.as_ref())? {
let _batch = batch?;
}
}Structs§
- Commit
Action - Per-commit handle returned by
super::CommitRange::commits. - Commit
Range - A contiguous range of Delta commits, holding resolved
[start_version, end_version]bounds plus the materialized commit-file pointers incommit_files. - Commit
Range Builder - Builder for a
CommitRange.
Enums§
- Commit
Ordering - Direction in which
CommitRange::commitsyields commits. Default isCommitOrdering::AscendingOrder - Delta
Action - A Delta log action kind.