Documentation
¶
Index ¶
- func IsCorruption(err error) bool
- func IsNotFound(err error) bool
- func IsRetryable(err error) bool
- func IsStorageFull(err error) bool
- func IsTimeout(err error) bool
- type ErrorType
- type StorageError
- func NewCorruptionError(op, key string, underlying error) *StorageError
- func NewIOError(op, key string, underlying error) *StorageError
- func NewIORetryableError(op, key string, underlying error) *StorageError
- func NewInternalError(op string, underlying error) *StorageError
- func NewInvalidRequestError(op, message string) *StorageError
- func NewLockError(op, key string, underlying error) *StorageError
- func NewNotFoundError(op, key string) *StorageError
- func NewStorageFullError(op string, underlying error) *StorageError
- func NewTemporaryError(op, key string, underlying error) *StorageError
- func NewTimeoutError(op, key string) *StorageError
- type VersionMismatchError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCorruption ¶
IsCorruption checks if an error indicates data corruption
func IsNotFound ¶
IsNotFound checks if an error is a not-found error
func IsStorageFull ¶
IsStorageFull checks if an error indicates storage is full
Types ¶
type ErrorType ¶
type ErrorType int
ErrorType represents the category of storage error
const ( // TypeNotFound indicates the requested resource was not found TypeNotFound ErrorType = iota // TypeInvalidRequest indicates the request parameters were invalid TypeInvalidRequest // TypeStorageFull indicates storage capacity has been exceeded TypeStorageFull // TypeCorruption indicates data corruption was detected TypeCorruption // TypeTemporary indicates a transient error that may succeed on retry TypeTemporary // TypeIO indicates a file system I/O error TypeIO // TypeLock indicates a resource locking conflict TypeLock // TypeTimeout indicates an operation timed out TypeTimeout // TypeInternal indicates an unexpected internal error TypeInternal )
type StorageError ¶
type StorageError struct {
Type ErrorType
Op string // Operation that failed (e.g., "Get", "Put", "Delete")
Key string // Key involved in the operation, if applicable
Message string // User-friendly error message
Retryable bool // Whether the operation can be retried
// contains filtered or unexported fields
}
StorageError represents a high-level storage error that abstracts internal implementation details
func NewCorruptionError ¶
func NewCorruptionError(op, key string, underlying error) *StorageError
NewCorruptionError creates a new corruption error
func NewIOError ¶
func NewIOError(op, key string, underlying error) *StorageError
NewIOError creates a new I/O error
func NewIORetryableError ¶
func NewIORetryableError(op, key string, underlying error) *StorageError
NewIORetryableError creates a new I/O error that is retryable
func NewInternalError ¶
func NewInternalError(op string, underlying error) *StorageError
NewInternalError creates a new internal error for unexpected conditions
func NewInvalidRequestError ¶
func NewInvalidRequestError(op, message string) *StorageError
NewInvalidRequestError creates a new invalid request error
func NewLockError ¶
func NewLockError(op, key string, underlying error) *StorageError
NewLockError creates a new lock conflict error
func NewNotFoundError ¶
func NewNotFoundError(op, key string) *StorageError
NewNotFoundError creates a new not-found error
func NewStorageFullError ¶
func NewStorageFullError(op string, underlying error) *StorageError
NewStorageFullError creates a new storage full error
func NewTemporaryError ¶
func NewTemporaryError(op, key string, underlying error) *StorageError
NewTemporaryError creates a new temporary error that can be retried
func NewTimeoutError ¶
func NewTimeoutError(op, key string) *StorageError
NewTimeoutError creates a new timeout error
func (*StorageError) Error ¶
func (e *StorageError) Error() string
Error implements the error interface
func (*StorageError) GetType ¶
func (e *StorageError) GetType() ErrorType
GetType returns the error type
func (*StorageError) IsRetryable ¶
func (e *StorageError) IsRetryable() bool
IsRetryable returns whether this error represents a retryable condition
func (*StorageError) Unwrap ¶
func (e *StorageError) Unwrap() error
Unwrap returns the underlying error for internal debugging
type VersionMismatchError ¶ added in v1.12.0
VersionMismatchError reports a lost conditional (CAS) operation: the key's current version did not equal the caller's expected version (issue #254). CurrentVersion carries the version observed after the operation resolved — 0 means the key is absent — so the caller can re-read, re-decide, and retry with a fresh precondition. It is deliberately not a StorageError: it is not retryable as-is (retrying with the same expectation loses again by definition) and represents a normal outcome, not a failure.
func IsVersionMismatch ¶ added in v1.12.0
func IsVersionMismatch(err error) (*VersionMismatchError, bool)
IsVersionMismatch reports whether err is (or wraps) a VersionMismatchError, returning it for access to CurrentVersion.
func NewVersionMismatchError ¶ added in v1.12.0
func NewVersionMismatchError(op, key string, current uint64) *VersionMismatchError
NewVersionMismatchError creates a VersionMismatchError.
func (*VersionMismatchError) Error ¶ added in v1.12.0
func (e *VersionMismatchError) Error() string