pub mod config;
pub mod gc;
pub mod push;
pub mod server;
pub mod signing;
pub use sui_castore::StoreError as CacheError;
pub use config::{CACHE_TIER_ENV, CacheConfig};
pub use sui_castore::BackendConfig;
pub use sui_castore::{ExpandEnvError, expand_env_vars};
pub use gc::GcResult;
pub use push::{LevelOutOfRange, NarCodec, PushResult, XzLevel, ZstdLevel};
pub use server::{AppState, build_router, serve};
pub use signing::{CacheSigner, verify_narinfo_signature};
pub use sui_castore::{
BytesNarSource, DEFAULT_INGEST_MEMORY_CAP, FileNarSource, LocalStorage, MemNarRefIndex,
NAR_CHUNK_BYTES, NAR_REF_PREFIX, NarRefIndex, NarRefKey, NarRefScan, NarResidency, NarSource,
NarStream, PgCacheConn, PgStorageBackend, PgTable, RedisBackend, RedisConn, S3Storage,
SpooledNarSource, StorageBackend, StorageIndex, TIERED_BACKEND_TIER, TieredBackend, TieredTier,
WritePolicy, advertised_nar_url, advertised_url_line, build_backend, bytes_stream, collect_nar,
empty_stream, file_stream, is_addressable_nar_path, is_servable_narinfo, referrer_of,
spool_or_buffer, whole_value_stream,
};
#[cfg(feature = "redis-client")]
pub use sui_castore::RedisConnectionManager;
#[cfg(feature = "postgres")]
pub use sui_castore::SqlxPgCacheConn;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn cache_error_is_store_error_display() {
let e = CacheError::PathNotFound("/nix/store/abc".to_string());
assert!(format!("{e}").contains("/nix/store/abc"));
}
#[test]
fn cache_error_io_display() {
let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "missing");
let e = CacheError::Io(io_err);
assert!(format!("{e}").contains("missing"));
}
#[test]
fn cache_error_signing_display() {
let e = CacheError::Signing("bad key".to_string());
assert!(format!("{e}").contains("bad key"));
}
#[test]
fn cache_error_not_implemented_display() {
let e = CacheError::NotImplemented("S3");
assert!(format!("{e}").contains("S3"));
}
#[test]
fn cache_error_narinfo_display() {
let e = CacheError::NarInfo("parse failed".to_string());
assert!(format!("{e}").contains("parse failed"));
}
}