XiaoHongbo-Hope commented on code in PR #103:
URL: https://github.com/apache/paimon-rust/pull/103#discussion_r2877966285


##########
crates/paimon/src/table/snapshot_manager.rs:
##########
@@ -0,0 +1,114 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Snapshot manager for reading snapshot metadata using FileIO.
+//!
+//! 
Reference:[org.apache.paimon.utils.SnapshotManager](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java).
+// TODO: remove when SnapshotManager is used (e.g. from Table or source 
planning).
+#![allow(dead_code)]
+
+use crate::io::FileIO;
+use crate::spec::Snapshot;
+use snafu::{FromString, Whatever};
+use std::str;
+
+const SNAPSHOT_DIR: &str = "snapshot";
+const LATEST_SNAPSHOT_FILE: &str = "LATEST";
+
+/// Manager for snapshot files using unified FileIO.
+///
+/// Reference: 
[org.apache.paimon.utils.SnapshotManager](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java).
+#[derive(Debug, Clone)]
+pub struct SnapshotManager {
+    file_io: FileIO,
+    table_path: String,
+}
+
+impl SnapshotManager {
+    /// Create a snapshot manager for the given table path and FileIO.
+    pub fn new(file_io: FileIO, table_path: String) -> Self {
+        Self {
+            file_io,
+            table_path,
+        }
+    }
+
+    /// Path to the snapshot directory (e.g. `table_path/snapshot`).
+    pub fn snapshot_dir(&self) -> String {
+        format!("{}/{}", self.table_path, SNAPSHOT_DIR)

Review Comment:
   Does this work well in Windows?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to