pub enum WriteType {
MustCache,
TryCache,
CacheThrough,
Through,
AsyncThrough,
}Expand description
High-level write type for Goosefs file creation.
This enum provides:
- String ↔ enum conversion (
FromStr/Display) — like JavaEnum.valueOf(). WritePTypeinterop — zero-cost conversion to/from the protobuf enum.
§String representation (case-insensitive)
| Variant | Strings |
|---|---|
MustCache | must_cache, MUST_CACHE |
TryCache | try_cache, TRY_CACHE |
CacheThrough | cache_through, CACHE_THROUGH |
Through | through, THROUGH |
AsyncThrough | async_through, ASYNC_THROUGH |
§Examples
use goosefs_sdk::config::WriteType;
// Parse from string (case-insensitive)
let wt: WriteType = "cache_through".parse().unwrap();
assert_eq!(wt, WriteType::CacheThrough);
// Display as canonical lowercase string
assert_eq!(wt.to_string(), "cache_through");
assert_eq!(wt.as_str(), "cache_through");
// Convert to protobuf WritePType
use goosefs_sdk::WritePType;
assert_eq!(WritePType::from(wt), WritePType::CacheThrough);
// Convert from protobuf WritePType
assert_eq!(WriteType::from(WritePType::Through), WriteType::Through);Variants§
MustCache
Write to Goosefs cache only; no UFS persistence.
TryCache
Try to cache; fall back to Through if cache is full.
CacheThrough
Write to cache and synchronously persist to UFS.
Through
Write directly to UFS, bypassing cache.
AsyncThrough
Write to cache, asynchronously persist to UFS later.
Implementations§
Source§impl WriteType
impl WriteType
Source§impl WriteType
Convert protobuf WritePType → WriteType.
impl WriteType
Convert protobuf WritePType → WriteType.
Returns Err for UnspecifiedWriteType and None (proto).
pub fn try_from_proto(pt: WritePType) -> Result<Self, String>
Trait Implementations§
Source§impl From<WritePType> for WriteType
Convenience: WritePType → WriteType (panics on Unspecified/None).
impl From<WritePType> for WriteType
Convenience: WritePType → WriteType (panics on Unspecified/None).
Source§fn from(pt: WritePType) -> Self
fn from(pt: WritePType) -> Self
Converts to this type from the input type.
Source§impl From<WriteType> for WritePType
Convert WriteType → protobuf WritePType.
impl From<WriteType> for WritePType
Convert WriteType → protobuf WritePType.
Source§impl FromStr for WriteType
Parse a WriteType from a string (case-insensitive).
impl FromStr for WriteType
Parse a WriteType from a string (case-insensitive).
Accepts both snake_case and UPPER_SNAKE_CASE forms.
impl Copy for WriteType
impl Eq for WriteType
impl StructuralPartialEq for WriteType
Auto Trait Implementations§
impl Freeze for WriteType
impl RefUnwindSafe for WriteType
impl Send for WriteType
impl Sync for WriteType
impl Unpin for WriteType
impl UnsafeUnpin for WriteType
impl UnwindSafe for WriteType
Blanket Implementations§
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request