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::CacheConfig;
pub use sui_castore::BackendConfig;
pub use sui_castore::{expand_env_vars, ExpandEnvError};
pub use gc::GcResult;
pub use push::PushResult;
pub use server::{build_router, serve, AppState};
pub use signing::{verify_narinfo_signature, CacheSigner};
pub use sui_castore::{
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, BytesNarSource, FileNarSource, LocalStorage, MemNarRefIndex, NarRefIndex,
NarRefKey, NarRefScan, NarResidency, NarSource, NarStream, PgCacheConn, PgStorageBackend,
PgTable, RedisBackend, RedisConn, S3Storage, SpooledNarSource, StorageBackend, StorageIndex,
TieredBackend, TieredTier, WritePolicy, DEFAULT_INGEST_MEMORY_CAP, NAR_CHUNK_BYTES,
NAR_REF_PREFIX, TIERED_BACKEND_TIER,
};
#[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"));
}
}