Skip to main content

aster_forge_storage_core/
lib.rs

1//! Shared storage utility helpers for Aster services.
2//!
3//! The crate contains storage-adjacent primitives that are independent of concrete drivers:
4//! safe relative object-key handling and S3-compatible endpoint normalization. Driver traits,
5//! connector wiring, and credential storage remain in application crates where policy decisions
6//! belong.
7#![deny(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
8#![cfg_attr(
9    not(test),
10    deny(
11        clippy::unwrap_used,
12        clippy::unreachable,
13        clippy::expect_used,
14        clippy::panic,
15        clippy::unimplemented,
16        clippy::todo
17    )
18)]
19
20pub mod object_key;
21pub mod s3_config;
22
23pub use object_key::{
24    join_key_prefix, normalize_object_key, normalize_object_prefix, normalize_relative_key,
25    strip_key_prefix,
26};
27pub use s3_config::{NormalizedS3Config, S3ConfigError, normalize_s3_endpoint_and_bucket};
28
29/// Result type returned by storage core helpers.
30pub type Result<T> = std::result::Result<T, StorageCoreError>;
31
32/// Errors produced by storage core helpers.
33#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
34pub enum StorageCoreError {
35    /// The object key is not a safe relative storage path.
36    #[error("{0}")]
37    InvalidObjectKey(String),
38}