Module io

Source
Expand description

File io implementation.

§How to build FileIO

We provided a FileIOBuilder to build FileIO from scratch. For example:

use iceberg::Result;
use iceberg::io::{FileIOBuilder, S3_REGION};

// Build a memory file io.
let file_io = FileIOBuilder::new("memory").build()?;
// Build an fs file io.
let file_io = FileIOBuilder::new("fs").build()?;
// Build an s3 file io.
let file_io = FileIOBuilder::new("s3")
    .with_prop(S3_REGION, "us-east-1")
    .build()?;

Or you can pass a path to ask FileIO to infer schema for you:

use iceberg::Result;
use iceberg::io::{FileIO, S3_REGION};

// Build a memory file io.
let file_io = FileIO::from_path("memory:///")?.build()?;
// Build an fs file io.
let file_io = FileIO::from_path("fs:///tmp")?.build()?;
// Build an s3 file io.
let file_io = FileIO::from_path("s3://bucket/a")?
    .with_prop(S3_REGION, "us-east-1")
    .build()?;

§How to use FileIO

Currently FileIO provides simple methods for file operations:

  • delete: Delete file.
  • exists: Check if file exists.
  • new_input: Create input file for reading.
  • new_output: Create output file for writing.

Structs§

AwsCredential
Credential that holds the access_key and secret_key.
CustomAwsCredentialLoader
Custom AWS credential loader. This can be used to load credentials from a custom source, such as the AWS SDK.
Extensions
Container for storing type-safe extensions used to configure underlying FileIO behavior.
FileIO
FileIO implementation, used to manipulate files in underlying storage.
FileIOBuilder
Builder for FileIO.
FileMetadata
The struct the represents the metadata of a file.
InputFile
Input file is used for reading from files.
OutputFile
Output file is used for writing to files..

Constants§

ADLS_ACCOUNT_KEY
The key to authentication against the account.
ADLS_ACCOUNT_NAME
The account that you want to connect to.
ADLS_AUTHORITY_HOST
The authority host of the service principal.
ADLS_CLIENT_ID
The client-id.
ADLS_CLIENT_SECRET
The client-secret.
ADLS_SAS_TOKEN
The shared access signature.
ADLS_TENANT_ID
The tenant-id.
CLIENT_REGION
Region to use for the S3 client.
GCS_ALLOW_ANONYMOUS
Option to skip signing requests (e.g. for public buckets/folders).
GCS_CREDENTIALS_JSON
Google Cloud Storage credentials JSON string, base64 encoded.
GCS_DISABLE_CONFIG_LOAD
Option to skip loading configuration from config file and the env.
GCS_DISABLE_VM_METADATA
Option to skip loading the credential from GCE metadata server (typically used in conjunction with GCS_ALLOW_ANONYMOUS).
GCS_NO_AUTH
Allow unauthenticated requests
GCS_PROJECT_ID
Google Cloud Project ID
GCS_SERVICE_PATH
Google Cloud Storage endpoint
GCS_TOKEN
Google Cloud Storage token
GCS_USER_PROJECT
Google Cloud user project
OSS_ACCESS_KEY_ID
Aliyun oss access key id.
OSS_ACCESS_KEY_SECRET
Aliyun oss access key secret.
OSS_ENDPOINT
Required configuration arguments for creating an Aliyun OSS Operator with OpenDAL:
S3_ACCESS_KEY_ID
S3 access key id.
S3_ALLOW_ANONYMOUS
Option to skip signing requests (e.g. for public buckets/folders).
S3_ASSUME_ROLE_ARN
If set, all AWS clients will assume a role of the given ARN, instead of using the default credential chain.
S3_ASSUME_ROLE_EXTERNAL_ID
Optional external ID used to assume an IAM role.
S3_ASSUME_ROLE_SESSION_NAME
Optional session name used to assume an IAM role.
S3_DISABLE_CONFIG_LOAD
Option to skip loading configuration from config file and the env.
S3_DISABLE_EC2_METADATA
Option to skip loading the credential from EC2 metadata (typically used in conjunction with S3_ALLOW_ANONYMOUS).
S3_ENDPOINT
Following are arguments for s3 file io. S3 endpoint.
S3_PATH_STYLE_ACCESS
S3 Path Style Access.
S3_REGION
S3 region.
S3_SECRET_ACCESS_KEY
S3 secret access key.
S3_SESSION_TOKEN
S3 session token. This is required when using temporary credentials.
S3_SSE_KEY
S3 Server Side Encryption Key. If S3 encryption type is kms, input is a KMS Key ID. In case this property is not set, default key “aws/s3” is used. If encryption type is custom, input is a custom base-64 AES256 symmetric key.
S3_SSE_MD5
S3 Server Side Encryption MD5.
S3_SSE_TYPE
S3 Server Side Encryption Type.

Traits§

AwsCredentialLoad
Loader trait will try to load credential from different sources.
FileRead
Trait for reading file.
FileWrite
Trait for writing file.