Skip to main content
pub struct KifsFileHandler  /* private fields */ 

Main class for interacting with the Kinetica File System (KiFS).

This handler provides a high-level API for file uploads, downloads, directory management, and file operations.

Example

Implementations

Source

pub fn new(db: Arc<Kinetica>, options: Option<KifsFileHandlerOptions>) -> Self

Creates a new KiFS file handler.

  • db - The Kinetica client instance
  • options - Optional file handler options (uses defaults if None)

Returns the file handler options.

The default thread pool termination timeout, in seconds.

The default number of full-file upload batches sent concurrently.

Source

pub async fn upload( &self, file_name: &str, remote_dir_name: &str, upload_options: Option<UploadOptions>, callback: Option<&dyn FileUploadListener>, ) -> Result<Vec<OperationResult>, KineticaError>

Uploads a single file from a local path to a KiFS directory.

  • file_name - Name and path of the file (or glob pattern) to upload
  • remote_dir_name - Name of the KiFS directory to upload to
  • upload_options - Optional upload options (uses defaults if None)
  • callback - Optional listener for progress callbacks

A vector of OperationResult for each file processed (successful or failed).

Returns an aggregated error containing all failure messages if any files fail to upload. The operation continues processing remaining files even when individual uploads fail.

Source

pub async fn upload_multiple( &self, file_names: Vec<String>, remote_dir_name: &str, upload_options: Option<UploadOptions>, callback: Option<&dyn FileUploadListener>, ) -> Result<Vec<OperationResult>, KineticaError>

Uploads multiple files to a KiFS directory.

  • file_names - Names and paths of the files (or glob patterns) to upload
  • remote_dir_name - Name of the KiFS directory to upload to
  • upload_options - Optional upload options (uses defaults if None)
  • callback - Optional listener for progress callbacks

A vector of OperationResult for each file processed (successful or failed).

Returns an aggregated error containing all failure messages if any files fail to upload. The operation continues processing remaining files even when individual uploads fail.

Source

pub async fn download( &self, file_name: &str, local_dir_name: &str, download_options: Option<DownloadOptions>, callback: Option<&dyn FileDownloadListener>, ) -> Result<Vec<OperationResult>, KineticaError>

Downloads a single KiFS file to a local directory.

  • file_name - Path of the KiFS file to download
  • local_dir_name - Path of the local directory to download to
  • download_options - Optional download options (uses defaults if None)
  • callback - Optional listener for progress callbacks

A vector of OperationResult for each file processed (successful or failed).

Returns an aggregated error containing all failure messages if any files fail to download. The operation continues processing remaining files even when individual downloads fail.

Source

pub async fn download_multiple( &self, file_names: Vec<String>, local_dir_name: &str, download_options: Option<DownloadOptions>, callback: Option<&dyn FileDownloadListener>, ) -> Result<Vec<OperationResult>, KineticaError>

Downloads multiple KiFS files to a local directory.

  • file_names - Paths of the KiFS files to download
  • local_dir_name - Path of the local directory to download to
  • download_options - Optional download options (uses defaults if None)
  • callback - Optional listener for progress callbacks

A vector of OperationResult for each file processed (successful or failed).

Returns an aggregated error containing all failure messages if any files fail to download. The operation continues processing remaining files even when individual downloads fail.

Source

pub async fn download_dir( &self, remote_dir_name: &str, local_dir_name: &str, download_options: Option<DownloadOptions>, callback: Option<&dyn FileDownloadListener>, ) -> Result<Vec<OperationResult>, KineticaError>

Downloads all files from a KiFS directory to a local directory.

Each file keeps its path below the KiFS directory: dir/a.csv is saved as <local dir>/a.csv, and dir/sub/x.csv as <local dir>/sub/x.csv, its subdirectory made as needed.

  • remote_dir_name - Path of the KiFS directory to download
  • local_dir_name - Path of the local directory to download to
  • download_options - Optional download options (uses defaults if None)
  • callback - Optional listener for progress callbacks

A vector of OperationResult for each file processed (successful or failed).

Returns an aggregated error containing all failure messages if any files fail to download. The operation continues processing remaining files even when individual downloads fail.

Source

pub async fn ingest( &self, file_names: Vec<String>, table_name: &str, ingest_options: Option<IngestOptions>, create_table_options: Option<TableCreationOptions>, ) -> Result<IngestResult, KineticaError>

Uploads local files and inserts their records into table_name.

The files, which may be glob patterns, are uploaded to a directory of their own under the user’s KiFS home directory, inserted from there with /insert/records/fromfiles and the options given, and the directory is deleted afterwards.

Fails if no file is named, a name is empty, or a file named (not a pattern) does not exist; and with the upload’s or the insert’s error if either fails.

Source

pub async fn delete_files( &self, file_names: Vec<String>, no_error_if_not_exists: bool, ) -> Result<(), KineticaError>

Deletes the given list of KiFS file paths.

  • file_names - List of files in KiFS to delete
  • no_error_if_not_exists - Whether to suppress errors if files don’t exist
Source

pub async fn delete_files_in_dir( &self, remote_dir_name: &str, no_error_if_not_exists: bool, ) -> Result<(), KineticaError>

Deletes files in the given KiFS directory.

The files found are deleted with one /delete/files request, sent even when there are none.

  • remote_dir_name - Name of the KiFS directory containing files to delete
  • no_error_if_not_exists - Whether to suppress errors if the directory doesn’t exist
Source

pub async fn show_files( &self, remote_paths: Vec<String>, ) -> Result<Vec<KifsFileInfo>, KineticaError>

Returns statistics about the given KiFS files and/or directories.

  • remote_paths - List of KiFS files and/or directory names

List of KifsFileInfo objects containing statistics about the files.

Source

pub async fn create_directory( &self, remote_dir_name: &str, no_error_if_exists: bool, ) -> Result<(), KineticaError>

Creates a KiFS directory with the given name.

  • remote_dir_name - Name of the KiFS directory to create
  • no_error_if_exists - Whether to suppress an error if the directory already exists
Source

pub async fn delete_directory( &self, remote_dir_name: &str, recursive: bool, no_error_if_not_exists: bool, ) -> Result<(), KineticaError>

Deletes the given KiFS directory.

  • remote_dir_name - Name of the KiFS directory to delete
  • recursive - Whether to delete all files and subdirectories
  • no_error_if_not_exists - Whether to suppress an error if the directory doesn’t exist
Source

pub async fn show_directories( &self, remote_dir_names: Vec<String>, ) -> Result<Vec<KifsDirectoryInfo>, KineticaError>

Returns statistics about the given KiFS directories: one entry for each.

  • remote_dir_names - List of KiFS directory names
Source

pub async fn show_directories_with_options( &self, remote_dir_names: Vec<String>, options: HashMap<String, String>, ) -> Result<Vec<KifsDirectoryInfo>, KineticaError>

Returns statistics about the given KiFS directories, one entry for each, passing options to each /show/directories.

Source

pub async fn show_directory( &self, remote_dir_name: &str, ) -> Result<Vec<KifsDirectoryInfo>, KineticaError>

Returns statistics about a single KiFS directory.

  • remote_dir_name - Name of the KiFS directory

List of KifsDirectoryInfo objects (may include subdirectories).

Source

pub async fn show_directory_with_options( &self, remote_dir_name: &str, options: HashMap<String, String>, ) -> Result<Vec<KifsDirectoryInfo>, KineticaError>

Returns statistics about a single KiFS directory, passing options to /show/directories.

Returns statistics about all KiFS directories.

List of KifsDirectoryInfo objects for all directories.

Returns statistics about all KiFS directories, passing options to /show/directories.

Source

pub async fn kifs_directory_exists(&self, dir_name: &str) -> bool

Checks whether the given KiFS directory exists.

  • dir_name - The full KiFS directory path to check

true if the directory exists, false otherwise.

Source

pub async fn kifs_directories_exist(&self, dir_names: &[String]) -> bool

Checks whether the given KiFS directories exist.

  • dir_names - The set of full KiFS directory paths to check

true if all directories exist, false otherwise.

Source

pub async fn kifs_file_exists(&self, file_name: &str) -> bool

Checks whether the given KiFS file exists.

  • file_name - The full KiFS file path to check

true if the file exists, false otherwise.