qubit_fs_testkit/file_system_contract.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Named phases shared by synchronous and asynchronous contract suites.
9
10/// One independently executable provider contract phase.
11///
12/// # Examples
13///
14/// ```
15/// use qubit_fs_testkit::FileSystemContract;
16///
17/// assert!(FileSystemContract::ALL.contains(&FileSystemContract::Properties));
18/// assert_eq!(FileSystemContract::ALL.len(), 12);
19/// ```
20#[derive(Clone, Copy, Debug, Eq, PartialEq)]
21pub enum FileSystemContract {
22 /// Immutable facade properties and fixture path compatibility.
23 Properties,
24 /// Metadata identity and provider-neutral file kinds.
25 Stat,
26 /// Reads, ranges, conditions, and checksum validation.
27 Read,
28 /// Writes, dispositions, conditions, replacement, and abort.
29 Write,
30 /// Direct, prefixed, metadata-bearing, and paged listings.
31 List,
32 /// Directory creation and recursive ancestor creation.
33 CreateDirectory,
34 /// Empty-directory/prefix and symbolic-link representations.
35 Representations,
36 /// File, directory, conditional, missing-ok, and recursive deletion.
37 Delete,
38 /// Copy methods, conflicts, statistics, and guarantees.
39 Copy,
40 /// Rename identity, conflicts, overwrite, and guarantees.
41 Rename,
42 /// Temporary file and directory lifecycle and persistence.
43 TempResources,
44 /// Structured public error context.
45 ErrorContext,
46}
47
48impl FileSystemContract {
49 /// Every named contract in dependency-safe execution order.
50 pub const ALL: [Self; 12] = [
51 Self::Properties,
52 Self::Stat,
53 Self::Read,
54 Self::Write,
55 Self::List,
56 Self::CreateDirectory,
57 Self::Representations,
58 Self::Delete,
59 Self::Copy,
60 Self::Rename,
61 Self::TempResources,
62 Self::ErrorContext,
63 ];
64}