pub enum PvcAccessMode {
ReadWriteOnce,
ReadOnlyMany,
ReadWriteMany,
ReadWriteOncePod,
Unknown(String),
}Expand description
A PersistentVolumeClaim access mode as a closed set — ReadWriteOnce,
ReadOnlyMany, ReadWriteMany, ReadWriteOncePod — so a typo is rejected by
the CRD schema itself instead of surfacing as a provisioner error at the first
backup or restore run.
Deliberately no Default (unlike other unit enums here): everywhere this
type appears, an absent/empty list means “inherit from context” — the source
PVC’s modes for a staged PVC, ReadWriteOnce for a restore-created PVC — so
there is no context-free default value to name.
The extra PvcAccessMode::Unknown variant exists ONLY so values persisted
before this field was schema-enforced still deserialize instead of erroring
the typed watch stream for the whole Kind (one legacy CR must never wedge every
other CR’s reconciliation). It is hidden from the CRD schema — the apiserver
rejects non-canonical strings on every new write — and
crate::validate::validate_access_modes rejects it loudly per-CR with the
offending value quoted.
use kopiur_api::common::PvcAccessMode;
// Canonical values round-trip as bare k8s strings.
assert_eq!(serde_json::to_value(PvcAccessMode::ReadOnlyMany).unwrap(), "ReadOnlyMany");
let m: PvcAccessMode = serde_json::from_value(serde_json::json!("ReadWriteOnce")).unwrap();
assert_eq!(m, PvcAccessMode::ReadWriteOnce);
// A legacy/bogus stored string decodes (never a watcher-poisoning error) into
// `Unknown`, preserving the value verbatim for the rejection message — and it
// re-serializes to the same string, so a read-modify-write never mutates it.
let m: PvcAccessMode = serde_json::from_value(serde_json::json!("ReadWriteOnze")).unwrap();
assert_eq!(m, PvcAccessMode::Unknown("ReadWriteOnze".into()));
assert_eq!(serde_json::to_value(&m).unwrap(), "ReadWriteOnze");Variants§
ReadWriteOnce
Mounted read-write by a single node (RWO).
ReadOnlyMany
Mounted read-only by many nodes (ROX) — e.g. a CephFS backingSnapshot
shallow-clone staged PVC.
ReadWriteMany
Mounted read-write by many nodes (RWX).
ReadWriteOncePod
Mounted read-write by a single pod (RWOP); the apiserver requires it
to be the sole mode on a PVC.
Unknown(String)
A non-canonical stored value (pre-schema-enforcement legacy data). Never
admissible on a new write (not in the CRD schema); consumers reject it via
crate::validate::validate_access_modes with the value quoted, instead
of a serde error that would poison the typed watcher.
Implementations§
Source§impl PvcAccessMode
impl PvcAccessMode
Trait Implementations§
Source§impl Clone for PvcAccessMode
impl Clone for PvcAccessMode
Source§fn clone(&self) -> PvcAccessMode
fn clone(&self) -> PvcAccessMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PvcAccessMode
impl Debug for PvcAccessMode
Source§impl<'de> Deserialize<'de> for PvcAccessMode
impl<'de> Deserialize<'de> for PvcAccessMode
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl JsonSchema for PvcAccessMode
impl JsonSchema for PvcAccessMode
Source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for PvcAccessMode
impl PartialEq for PvcAccessMode
Source§fn eq(&self, other: &PvcAccessMode) -> bool
fn eq(&self, other: &PvcAccessMode) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PvcAccessMode
impl Serialize for PvcAccessMode
impl Eq for PvcAccessMode
impl StructuralPartialEq for PvcAccessMode
Auto Trait Implementations§
impl Freeze for PvcAccessMode
impl RefUnwindSafe for PvcAccessMode
impl Send for PvcAccessMode
impl Sync for PvcAccessMode
impl Unpin for PvcAccessMode
impl UnsafeUnpin for PvcAccessMode
impl UnwindSafe for PvcAccessMode
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more