Skip to main content

qubit_fs/options/
write_mode.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//! Write creation mode.
11
12/// Write creation mode.
13#[derive(Clone, Debug, Eq, PartialEq)]
14pub enum WriteMode {
15    /// Create a new resource and fail when the target exists.
16    CreateNew,
17    /// Create or truncate an existing resource.
18    CreateOrTruncate,
19    /// Append to an existing resource.
20    Append,
21    /// Replace the target atomically.
22    ReplaceAtomic,
23    /// Replace only when the target version matches.
24    ConditionalReplace {
25        /// Required target ETag or provider version.
26        etag: String,
27    },
28}
29
30impl Default for WriteMode {
31    /// Creates or truncates by default.
32    #[inline]
33    fn default() -> Self {
34        Self::CreateOrTruncate
35    }
36}