Skip to main content

shardline_server/error/
object_store.rs

1use shardline_storage::{LocalObjectStoreError, ObjectPrefixError, S3ObjectStoreError};
2use thiserror::Error;
3
4/// Object-storage subsystem failure.
5#[derive(Debug, Error)]
6pub enum ObjectStoreError {
7    /// Local storage IO failed.
8    #[error("local storage operation failed")]
9    Local(#[from] LocalObjectStoreError),
10    /// S3-compatible object-storage adapter access failed.
11    #[error("s3 object storage adapter operation failed")]
12    S3(#[from] S3ObjectStoreError),
13    /// Object inventory prefix validation failed.
14    #[error("object storage prefix validation failed")]
15    Prefix(#[from] ObjectPrefixError),
16    /// S3-compatible object storage was selected without concrete configuration.
17    #[error("s3 object storage configuration is missing")]
18    MissingS3Config,
19    /// Stored object metadata disagreed with the expected transfer length.
20    #[error("stored object length did not match indexed metadata")]
21    StoredLengthMismatch,
22    /// Storage migration found a content-addressed source object under the wrong key.
23    #[error(
24        "storage migration source object hash mismatch for key {key}: expected {expected_hash}, observed {observed_hash}"
25    )]
26    MigrationSourceHashMismatch {
27        /// Content-addressed object key being migrated.
28        key: String,
29        /// Hash implied by the object key.
30        expected_hash: String,
31        /// Hash computed from the source object bytes.
32        observed_hash: String,
33    },
34}