Skip to main content

qubit_fs/metadata/
file_system_metadata.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//! Filesystem instance metadata.
11
12use qubit_metadata::Metadata;
13
14use crate::{
15    FileSystemCapabilities,
16    PathSemantics,
17};
18
19/// Metadata describing one filesystem instance.
20#[derive(Clone, Debug, PartialEq)]
21pub struct FileSystemMetadata {
22    /// Provider id that created this filesystem.
23    pub provider_id: String,
24    /// Schemes accepted by the provider.
25    pub schemes: Vec<String>,
26    /// Capability hints for this filesystem.
27    pub capabilities: FileSystemCapabilities,
28    /// Path semantics used by this filesystem.
29    pub path_semantics: PathSemantics,
30    /// Provider-native metadata.
31    pub provider_metadata: Metadata,
32}
33
34impl FileSystemMetadata {
35    /// Creates filesystem metadata for one provider.
36    ///
37    /// # Parameters
38    /// - `provider_id`: Provider id.
39    ///
40    /// # Returns
41    /// Metadata with default capabilities and path semantics.
42    #[inline]
43    #[must_use]
44    pub fn new(provider_id: &str) -> Self {
45        Self {
46            provider_id: provider_id.to_owned(),
47            schemes: Vec::new(),
48            capabilities: FileSystemCapabilities::default(),
49            path_semantics: PathSemantics::default(),
50            provider_metadata: Metadata::new(),
51        }
52    }
53}