Skip to main content

qubit_fs/provider/
file_system_config.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Provider configuration for filesystem creation.
11
12use qubit_metadata::Metadata;
13
14use crate::{
15    CredentialRef,
16    FsUri,
17};
18
19/// Configuration passed to filesystem providers.
20#[derive(Clone, Debug, PartialEq)]
21pub struct FileSystemConfig {
22    /// URI used to select and initialize the provider.
23    pub uri: FsUri,
24    /// Non-sensitive provider options.
25    pub options: Metadata,
26    /// Optional credential reference.
27    pub credentials: Option<CredentialRef>,
28}
29
30impl FileSystemConfig {
31    /// Creates provider configuration from a URI.
32    ///
33    /// # Parameters
34    /// - `uri`: Parsed filesystem URI.
35    ///
36    /// # Returns
37    /// Provider configuration with no extra options or credentials.
38    #[inline]
39    #[must_use]
40    pub fn new(uri: FsUri) -> Self {
41        Self {
42            uri,
43            options: Metadata::new(),
44            credentials: None,
45        }
46    }
47}