09f019730f
- Add credentials.rs with CredentialStore, redacted Debug (session_token shows [REDACTED]) - Add nfs.rs with ESTALE retry using Fn closure, 5s health timeout - Add smb.rs with ENOTCONN retry handling, 5s health timeout - Add s3.rs/sftp.rs feature-gated stubs with security documentation - Add error variants: S3, Sftp, Timeout, Credential, NfsStaleHandle - Fix delta.rs unused imports Oracle fixes applied: - SMB retry_on_disconnect for ENOTCONN (errno 107) - session_token Debug shows [REDACTED] when Some, None otherwise - NFS/SMB health checks wrapped with tokio::time::timeout(5s) 102 tests pass, 0 warnings.
68 lines
1.4 KiB
Rust
68 lines
1.4 KiB
Rust
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum Error {
|
|
#[error("I/O error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Origin not found: {0}")]
|
|
OriginNotFound(String),
|
|
|
|
#[error("File not found: {0}")]
|
|
FileNotFound(String),
|
|
|
|
#[error("Path resolution failed: {0}")]
|
|
PathResolution(String),
|
|
|
|
#[error("Cache error: {0}")]
|
|
Cache(String),
|
|
|
|
#[error("Metadata extraction error: {0}")]
|
|
Metadata(String),
|
|
|
|
#[error("Database error: {0}")]
|
|
Database(String),
|
|
|
|
#[error("NFS stale file handle")]
|
|
NfsStaleHandle,
|
|
|
|
#[error("Operation not permitted (read-only filesystem)")]
|
|
ReadOnly,
|
|
|
|
#[error("No origin available to serve request")]
|
|
NoOriginAvailable,
|
|
|
|
#[error("Maximum retries exceeded")]
|
|
MaxRetriesExceeded,
|
|
|
|
#[error("Origin error: {0}")]
|
|
Origin(String),
|
|
|
|
#[error("S3 error: {0}")]
|
|
S3(String),
|
|
|
|
#[error("SFTP error: {0}")]
|
|
Sftp(String),
|
|
|
|
#[error("Operation timed out: {0}")]
|
|
Timeout(String),
|
|
|
|
#[error("Credential error: {0}")]
|
|
Credential(String),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
impl Error {
|
|
pub fn is_not_found(&self) -> bool {
|
|
matches!(self, Error::FileNotFound(_))
|
|
}
|
|
|
|
pub fn downcast_io(&self) -> Option<&std::io::Error> {
|
|
match self {
|
|
Error::Io(e) => Some(e),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|