Skip to content

[rust] Add SnapshotId type alias and use it in snapshot metadata paths#3642

Merged
fresh-borzoni merged 1 commit into
apache:mainfrom
Olawoyin007:rust-snapshotid-type-alias
Jul 14, 2026
Merged

[rust] Add SnapshotId type alias and use it in snapshot metadata paths#3642
fresh-borzoni merged 1 commit into
apache:mainfrom
Olawoyin007:rust-snapshotid-type-alias

Conversation

@Olawoyin007

Copy link
Copy Markdown
Contributor

Purpose

Moved from apache/fluss-rust#657 at @fresh-borzoni's request, now that the fluss-rust repo has been merged into this monorepo. Original issue: apache/fluss-rust#636.

TableId, PartitionId, and BucketId already have type aliases in lib.rs, but snapshot_id was still spelled i64 everywhere. This adds a matching SnapshotId alias so snapshot-related signatures read consistently with the other ID types.

Brief change log

  • Add pub type SnapshotId = i64; next to the existing aliases in fluss-rust/crates/fluss/src/lib.rs.
  • Apply it to the hand-written sites: LakeSnapshot (metadata/table.rs), LakeSnapshotInfo, KvSnapshot, KvSnapshotLeaseForBucket, the admin client methods (get_kv_snapshot_metadata, get_lake_snapshot), and the GetKvSnapshotMetadataRequest / GetLakeSnapshotRequest constructors.
  • Generated proto code is untouched; HashMap<TableBucket, i64> offset values stay i64 since they are offsets, not snapshot IDs.

Tests

No behavior change (the alias resolves to the same type). cargo build -p fluss-rs, cargo test -p fluss-rs --lib (571 passed, 0 failed), and cargo fmt -p fluss-rs --check are all clean.

API and Format

Public signatures now name SnapshotId instead of i64; since it is a plain type alias, this is source- and ABI-compatible. No storage format impact.

Documentation

No new feature; no documentation changes needed.

🤖 Generated with Claude Code

TableId, PartitionId, and BucketId already have type aliases in lib.rs, but
snapshot_id was still spelled i64 everywhere. Add a matching SnapshotId alias
so snapshot-related signatures read consistently with the other ID types.

Applied to the hand-written sites: LakeSnapshot (metadata/table.rs),
LakeSnapshotInfo, KvSnapshot, KvSnapshotLeaseForBucket, the admin client
methods (get_kv_snapshot_metadata, get_lake_snapshot), and the
GetKvSnapshotMetadataRequest / GetLakeSnapshotRequest constructors. Generated
proto code is untouched; HashMap<TableBucket, i64> offset values stay i64
since they are offsets, not snapshot IDs.

No behavior change (the alias resolves to the same type). Ported from
apache/fluss-rust#657 at the maintainer's request after the fluss-rust repo
was merged into this monorepo.
@Olawoyin007

Copy link
Copy Markdown
Contributor Author

@fresh-borzoni moved here from apache/fluss-rust#657 as requested (the change now lives under fluss-rust/crates/fluss/). Rebuilt against the monorepo: cargo build -p fluss-rs and cargo fmt -p fluss-rs --check clean, cargo test -p fluss-rs --lib 571 passed. Ready for review, thanks!

@fresh-borzoni fresh-borzoni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Olawoyin007 Thank you for the PR, LGTM 👍

@fresh-borzoni
fresh-borzoni merged commit 641e5a3 into apache:main Jul 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants