Skip to content

Commit 4fe4508

Browse files
authored
refactor: rename Snapshot.checkpoint (delta-io#1608)
## 🥞 Stacked PR Use this [link](https://github.com/delta-io/delta-kernel-rs/pull/1608/files) to review incremental changes. - [**stack/rename-checkpoint**](delta-io#1608) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/1608/files)] - [stack/perform-checkpoint](delta-io#1600) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/1600/files/b2556bc302d7fe25cdb879f3fc085075c6835240..743587c71cddca53a7313b4d515d0ad1495748e4)] - [stack/ffi-checkpoint](delta-io#1611) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/1611/files/743587c71cddca53a7313b4d515d0ad1495748e4..6d390888a36ce2867b1375b49b7976145ceb27a0)] --------- ## What changes are proposed in this pull request? Current `snapshot.checkpoint()` method actually creates a `CheckpointWriter`. This PR renamed it to `create_checkpoint_writer` so that the name better aligns with the functionality. <!-- **Uncomment** this section if there are any changes affecting public APIs. Else, **delete** this section. ### This PR affects the following public APIs If there are breaking changes, please ensure the `breaking-changes` label gets added by CI, and describe why the changes are needed. Note that _new_ public APIs are not considered breaking. --> ## How was this change tested? Existing.
1 parent f0ff1e6 commit 4fe4508

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

kernel/examples/checkpoint-table/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async fn try_main() -> DeltaResult<()> {
6868
let snapshot = Snapshot::builder_for(url).build(&engine)?;
6969

7070
// first we create a checkpoint writer
71-
let writer = snapshot.checkpoint()?;
71+
let writer = snapshot.create_checkpoint_writer()?;
7272

7373
// this tells us the path where we should write the checkpoint file
7474
let checkpoint_path = writer.checkpoint_path()?;

kernel/src/checkpoint/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This module implements the API for writing single-file checkpoints.
22
//!
3-
//! The entry point for this API is [`Snapshot::checkpoint`].
3+
//! The entry point for this API is [`Snapshot::create_checkpoint_writer`].
44
//!
55
//! ## Checkpoint Types and Selection Logic
66
//! This API supports two checkpoint types, selected based on table features:
@@ -22,7 +22,7 @@
2222
//!
2323
//! The following steps outline the process of creating a checkpoint:
2424
//!
25-
//! 1. Create a [`CheckpointWriter`] using [`Snapshot::checkpoint`]
25+
//! 1. Create a [`CheckpointWriter`] using [`Snapshot::create_checkpoint_writer`]
2626
//! 2. Get the checkpoint path from [`CheckpointWriter::checkpoint_path`]
2727
//! 2. Get the checkpoint data from [`CheckpointWriter::checkpoint_data`]
2828
//! 3. Write the data to the path in object storage (engine-specific)
@@ -51,7 +51,7 @@
5151
//! let snapshot = Snapshot::builder_for(url).build(engine)?;
5252
//!
5353
//! // Create a checkpoint writer from the snapshot
54-
//! let mut writer = snapshot.checkpoint()?;
54+
//! let mut writer = snapshot.create_checkpoint_writer()?;
5555
//!
5656
//! // Get the checkpoint path and data
5757
//! let checkpoint_path = writer.checkpoint_path()?;
@@ -80,7 +80,7 @@
8080
//!
8181
//! [`CheckpointMetadata`]: crate::actions::CheckpointMetadata
8282
//! [`LastCheckpointHint`]: crate::last_checkpoint_hint::LastCheckpointHint
83-
//! [`Snapshot::checkpoint`]: crate::Snapshot::checkpoint
83+
//! [`Snapshot::create_checkpoint_writer`]: crate::Snapshot::create_checkpoint_writer
8484
// Future extensions:
8585
// - TODO(#837): Multi-file V2 checkpoints are not supported yet. The API is designed to be extensible for future
8686
// multi-file support, but the current implementation only supports single-file checkpoints.

kernel/src/checkpoint/tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async fn test_create_checkpoint_metadata_batch() -> DeltaResult<()> {
7575

7676
let table_root = Url::parse("memory:///")?;
7777
let snapshot = Snapshot::builder_for(table_root).build(&engine)?;
78-
let writer = snapshot.checkpoint()?;
78+
let writer = snapshot.create_checkpoint_writer()?;
7979

8080
let checkpoint_batch = writer.create_checkpoint_metadata_batch(&engine)?;
8181
assert!(checkpoint_batch.filtered_data.has_selected_rows());
@@ -296,7 +296,7 @@ async fn test_v1_checkpoint_latest_version_by_default() -> DeltaResult<()> {
296296

297297
let table_root = Url::parse("memory:///")?;
298298
let snapshot = Snapshot::builder_for(table_root).build(&engine)?;
299-
let writer = snapshot.checkpoint()?;
299+
let writer = snapshot.create_checkpoint_writer()?;
300300

301301
// Verify the checkpoint file path is the latest version by default.
302302
assert_eq!(
@@ -368,7 +368,7 @@ async fn test_v1_checkpoint_specific_version() -> DeltaResult<()> {
368368
let snapshot = Snapshot::builder_for(table_root)
369369
.at_version(0)
370370
.build(&engine)?;
371-
let writer = snapshot.checkpoint()?;
371+
let writer = snapshot.create_checkpoint_writer()?;
372372

373373
// Verify the checkpoint file path is the specified version.
374374
assert_eq!(
@@ -419,7 +419,7 @@ async fn test_finalize_errors_if_checkpoint_data_iterator_is_not_exhausted() ->
419419
let snapshot = Snapshot::builder_for(table_root)
420420
.at_version(0)
421421
.build(&engine)?;
422-
let writer = snapshot.checkpoint()?;
422+
let writer = snapshot.create_checkpoint_writer()?;
423423
let data_iter = writer.checkpoint_data(&engine)?;
424424

425425
/* The returned data iterator has batches that we do not consume */
@@ -475,7 +475,7 @@ async fn test_v2_checkpoint_supported_table() -> DeltaResult<()> {
475475

476476
let table_root = Url::parse("memory:///")?;
477477
let snapshot = Snapshot::builder_for(table_root).build(&engine)?;
478-
let writer = snapshot.checkpoint()?;
478+
let writer = snapshot.create_checkpoint_writer()?;
479479

480480
// Verify the checkpoint file path is the latest version by default.
481481
assert_eq!(
@@ -556,7 +556,7 @@ async fn test_no_checkpoint_staged_commits() -> DeltaResult<()> {
556556
.build(&engine)?;
557557

558558
assert!(matches!(
559-
snapshot.checkpoint().unwrap_err(),
559+
snapshot.create_checkpoint_writer().unwrap_err(),
560560
crate::Error::Generic(e) if e == "Found staged commit file in log segment"
561561
));
562562
Ok(())

kernel/src/snapshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl Snapshot {
380380
///
381381
/// See the [`crate::checkpoint`] module documentation for more details on checkpoint types
382382
/// and the overall checkpoint process.
383-
pub fn checkpoint(self: Arc<Self>) -> DeltaResult<CheckpointWriter> {
383+
pub fn create_checkpoint_writer(self: Arc<Self>) -> DeltaResult<CheckpointWriter> {
384384
CheckpointWriter::try_new(self)
385385
}
386386

0 commit comments

Comments
 (0)