liurenjie1024 commented on code in PR #1080: URL: https://github.com/apache/iceberg-rust/pull/1080#discussion_r1992675152
########## crates/iceberg/src/transaction/snapshot.rs: ########## @@ -0,0 +1,309 @@ +// 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. + +use std::collections::HashMap; +use std::future::Future; +use std::ops::RangeFrom; + +use uuid::Uuid; + +use crate::error::Result; +use crate::io::OutputFile; +use crate::spec::{ + DataFile, DataFileFormat, FormatVersion, ManifestEntry, ManifestFile, ManifestListWriter, + ManifestWriterBuilder, Operation, Snapshot, SnapshotReference, SnapshotRetention, Struct, + StructType, Summary, MAIN_BRANCH, +}; +use crate::transaction::Transaction; +use crate::{Error, ErrorKind, TableRequirement, TableUpdate}; + +const META_ROOT_PATH: &str = "metadata"; + +pub trait SnapshotProduceOperation: Send + Sync { + fn operation(&self) -> Operation; + #[allow(unused)] + fn delete_entries( + &self, + snapshot_produce: &SnapshotProduceAction, + ) -> impl Future<Output = Result<Vec<ManifestEntry>>> + Send; + fn existing_manifest( + &self, + snapshot_produce: &SnapshotProduceAction, + ) -> impl Future<Output = Result<Vec<ManifestFile>>> + Send; +} + +pub struct DefaultManifestProcess; Review Comment: ```suggestion pub(crate) struct DefaultManifestProcess; ``` ########## crates/iceberg/src/transaction/snapshot.rs: ########## @@ -0,0 +1,309 @@ +// 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. + +use std::collections::HashMap; +use std::future::Future; +use std::ops::RangeFrom; + +use uuid::Uuid; + +use crate::error::Result; +use crate::io::OutputFile; +use crate::spec::{ + DataFile, DataFileFormat, FormatVersion, ManifestEntry, ManifestFile, ManifestListWriter, + ManifestWriterBuilder, Operation, Snapshot, SnapshotReference, SnapshotRetention, Struct, + StructType, Summary, MAIN_BRANCH, +}; +use crate::transaction::Transaction; +use crate::{Error, ErrorKind, TableRequirement, TableUpdate}; + +const META_ROOT_PATH: &str = "metadata"; + +pub trait SnapshotProduceOperation: Send + Sync { + fn operation(&self) -> Operation; + #[allow(unused)] + fn delete_entries( + &self, + snapshot_produce: &SnapshotProduceAction, + ) -> impl Future<Output = Result<Vec<ManifestEntry>>> + Send; + fn existing_manifest( + &self, + snapshot_produce: &SnapshotProduceAction, + ) -> impl Future<Output = Result<Vec<ManifestFile>>> + Send; +} + +pub struct DefaultManifestProcess; + +impl ManifestProcess for DefaultManifestProcess { + fn process_manifeset(&self, manifests: Vec<ManifestFile>) -> Vec<ManifestFile> { + manifests + } +} + +pub trait ManifestProcess: Send + Sync { + fn process_manifeset(&self, manifests: Vec<ManifestFile>) -> Vec<ManifestFile>; +} + +pub struct SnapshotProduceAction<'a> { Review Comment: ```suggestion pub(crate) struct SnapshotProduceAction<'a> { ``` ########## crates/iceberg/src/transaction/snapshot.rs: ########## @@ -0,0 +1,309 @@ +// 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. + +use std::collections::HashMap; +use std::future::Future; +use std::ops::RangeFrom; + +use uuid::Uuid; + +use crate::error::Result; +use crate::io::OutputFile; +use crate::spec::{ + DataFile, DataFileFormat, FormatVersion, ManifestEntry, ManifestFile, ManifestListWriter, + ManifestWriterBuilder, Operation, Snapshot, SnapshotReference, SnapshotRetention, Struct, + StructType, Summary, MAIN_BRANCH, +}; +use crate::transaction::Transaction; +use crate::{Error, ErrorKind, TableRequirement, TableUpdate}; + +const META_ROOT_PATH: &str = "metadata"; + +pub trait SnapshotProduceOperation: Send + Sync { Review Comment: ```suggestion pub(crate) trait SnapshotProduceOperation: Send + Sync { ``` ########## crates/iceberg/src/transaction/snapshot.rs: ########## @@ -0,0 +1,309 @@ +// 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. + +use std::collections::HashMap; +use std::future::Future; +use std::ops::RangeFrom; + +use uuid::Uuid; + +use crate::error::Result; +use crate::io::OutputFile; +use crate::spec::{ + DataFile, DataFileFormat, FormatVersion, ManifestEntry, ManifestFile, ManifestListWriter, + ManifestWriterBuilder, Operation, Snapshot, SnapshotReference, SnapshotRetention, Struct, + StructType, Summary, MAIN_BRANCH, +}; +use crate::transaction::Transaction; +use crate::{Error, ErrorKind, TableRequirement, TableUpdate}; + +const META_ROOT_PATH: &str = "metadata"; + +pub trait SnapshotProduceOperation: Send + Sync { + fn operation(&self) -> Operation; + #[allow(unused)] + fn delete_entries( + &self, + snapshot_produce: &SnapshotProduceAction, + ) -> impl Future<Output = Result<Vec<ManifestEntry>>> + Send; + fn existing_manifest( + &self, + snapshot_produce: &SnapshotProduceAction, + ) -> impl Future<Output = Result<Vec<ManifestFile>>> + Send; +} + +pub struct DefaultManifestProcess; + +impl ManifestProcess for DefaultManifestProcess { + fn process_manifeset(&self, manifests: Vec<ManifestFile>) -> Vec<ManifestFile> { + manifests + } +} + +pub trait ManifestProcess: Send + Sync { Review Comment: ```suggestion pub(crate) trait ManifestProcess: Send + Sync { ``` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
