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
use crate::{CellId, DirId, GeneratedNameKind, NamespaceName};
/// Typed failures for backend-neutral expression-tree namespace records.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NamespaceError {
/// An id constructor received empty text.
EmptyId {
/// The id family being constructed.
kind: &'static str,
},
/// A child name is not legal as a canonical Table path segment.
IllegalName(String),
/// A parent directory is unknown to this namespace.
MissingDir(DirId),
/// A cell is unknown to this namespace.
MissingCell(CellId),
/// A directory is unknown to this namespace.
MissingDirRecord(DirId),
/// A child name is already occupied under the parent directory.
NameCollision {
/// The parent directory containing the conflicting name.
parent: DirId,
/// The conflicting child name.
name: NamespaceName,
},
/// A cell record cannot be created without a durable name reservation.
MissingReservation {
/// The parent directory for the requested create.
parent: DirId,
/// The child name that was not reserved.
name: NamespaceName,
},
/// A recovered generated-name counter is behind durable namespace state.
CounterCorruption {
/// The parent directory whose counter is corrupt.
parent: DirId,
/// The generated-name family whose counter is corrupt.
kind: GeneratedNameKind,
/// The occupied candidate produced by the corrupt counter.
candidate: NamespaceName,
},
/// Another writer lane is already active.
WriterAlreadyActive,
/// The caller supplied no valid writer lane.
InvalidWriterLane,
/// The root directory cannot be renamed or moved.
RootDirCannotMove,
/// A directory cannot be moved below itself.
DirMoveCycle {
/// The directory being moved.
dir: DirId,
/// The requested new parent.
new_parent: DirId,
},
/// A directory must be empty before it can be deleted.
DirNotEmpty(DirId),
}