iceberg/io/
mod.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18//! File io implementation.
19//!
20//! # How to build `FileIO`
21//!
22//! `FileIO` uses explicit `StorageFactory` injection for storage creation.
23//! We provide convenience constructors for common use cases:
24//!
25//! ```rust,ignore
26//! use iceberg::io::{FileIO, FileIOBuilder};
27//! use iceberg::io::{LocalFsStorageFactory, MemoryStorageFactory};
28//! use std::sync::Arc;
29//!
30//! // Build a memory file io for testing
31//! let file_io = FileIO::new_with_memory();
32//!
33//! // Build a local filesystem file io
34//! let file_io = FileIO::new_with_fs();
35//!
36//! // Build with explicit factory and configuration
37//! let file_io = FileIOBuilder::new(Arc::new(LocalFsStorageFactory))
38//!     .with_prop("key", "value")
39//!     .build();
40//! ```
41//!
42//! # How to use `FileIO`
43//!
44//! Currently `FileIO` provides simple methods for file operations:
45//!
46//! - `delete`: Delete file.
47//! - `delete_prefix`: Delete all files with a given prefix.
48//! - `exists`: Check if file exists.
49//! - `new_input`: Create input file for reading.
50//! - `new_output`: Create output file for writing.
51
52mod file_io;
53mod storage;
54
55pub use file_io::*;
56pub use storage::*;
57
58pub(crate) mod object_cache;
59
60pub(crate) fn is_truthy(value: &str) -> bool {
61    ["true", "t", "1", "on"].contains(&value.to_lowercase().as_str())
62}