1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Typed filesystem capability identifiers.
/// A stable operation or semantic guarantee advertised by a filesystem.
///
/// # Examples
///
/// ```rust
/// use qubit_fs::metadata::FileSystemCapability;
///
/// assert!(matches!(FileSystemCapability::Read, FileSystemCapability::Read));
/// ```
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[repr(u8)]
#[non_exhaustive]
pub enum FileSystemCapability {
/// Directory or prefix listing.
List = 0,
/// Sequential byte reads.
Read = 1,
/// Required byte-range reads.
RangeRead = 2,
/// Version-conditional reads.
ConditionalRead = 3,
/// Provider-backed checksum validation for reads.
ChecksumValidation = 4,
/// File or object writes.
Write = 5,
/// Append writes.
Append = 6,
/// Conditional writes.
ConditionalWrite = 7,
/// Directory creation.
CreateDirectory = 8,
/// Native empty-directory representation.
EmptyDirectory = 9,
/// Resource deletion.
Delete = 10,
/// Recursive directory or prefix deletion.
RecursiveDelete = 11,
/// Version-conditional deletion.
ConditionalDelete = 12,
/// Rename or move.
Rename = 13,
/// Atomic rename.
AtomicRename = 14,
/// Atomic replacement publication.
AtomicReplace = 15,
/// Application-visible copy support supplied by a provider `TryCopy`
/// operation or the facade's allowlisted stream fallback.
Copy = 16,
/// Server-side copy without downloading payload bytes.
ServerSideCopy = 17,
/// Symbolic links.
Symlink = 18,
/// Native or configured temporary files.
TempFile = 19,
/// Native or configured temporary directories.
TempDirectory = 20,
/// Atomic temporary-resource persistence.
AtomicTempPersist = 21,
/// Atomic publication of a copied regular file or object.
AtomicFileCopy = 22,
/// Atomic publication of a copied directory tree or prefix.
AtomicTreeCopy = 23,
/// Durable publication of a copied regular file or object.
DurableFileCopy = 24,
/// Durable publication of a copied directory tree or prefix.
DurableTreeCopy = 25,
/// Durable publication of a renamed resource.
DurableRename = 26,
/// Durable publication of a completed write session.
DurableWrite = 27,
}
impl FileSystemCapability {
/// Stable list of every capability known by this crate version.
pub const ALL: &'static [Self] = &[
Self::List,
Self::Read,
Self::RangeRead,
Self::ConditionalRead,
Self::ChecksumValidation,
Self::Write,
Self::Append,
Self::ConditionalWrite,
Self::CreateDirectory,
Self::EmptyDirectory,
Self::Delete,
Self::RecursiveDelete,
Self::ConditionalDelete,
Self::Rename,
Self::AtomicRename,
Self::AtomicReplace,
Self::Copy,
Self::ServerSideCopy,
Self::Symlink,
Self::TempFile,
Self::TempDirectory,
Self::AtomicTempPersist,
Self::AtomicFileCopy,
Self::AtomicTreeCopy,
Self::DurableFileCopy,
Self::DurableTreeCopy,
Self::DurableRename,
Self::DurableWrite,
];
/// Returns the bit representing this capability in a capability set.
#[inline]
pub(crate) const fn bit(self) -> u128 {
1_u128 << (self as u8)
}
}