1pub mod config;
17pub mod gc;
18pub mod push;
19pub mod server;
20pub mod signing;
21
22pub use sui_castore::StoreError as CacheError;
33
34pub use config::{CACHE_TIER_ENV, CacheConfig};
35
36pub use sui_castore::BackendConfig;
39
40pub use sui_castore::{ExpandEnvError, expand_env_vars};
44
45pub use gc::GcResult;
46pub use push::{LevelOutOfRange, NarCodec, PushResult, XzLevel, ZstdLevel};
47pub use server::{AppState, build_router, serve};
48pub use signing::{CacheSigner, verify_narinfo_signature};
49
50pub use sui_castore::{
52 BytesNarSource, DEFAULT_INGEST_MEMORY_CAP, FileNarSource, LocalStorage, MemNarRefIndex,
53 NAR_CHUNK_BYTES, NAR_REF_PREFIX, NarRefIndex, NarRefKey, NarRefScan, NarResidency, NarSource,
54 NarStream, PgCacheConn, PgStorageBackend, PgTable, RedisBackend, RedisConn, S3Storage,
55 SpooledNarSource, StorageBackend, StorageIndex, TIERED_BACKEND_TIER, TieredBackend, TieredTier,
56 WritePolicy, advertised_nar_url, advertised_url_line, build_backend, bytes_stream, collect_nar,
57 empty_stream, file_stream, is_addressable_nar_path, is_servable_narinfo, referrer_of,
58 spool_or_buffer, whole_value_stream,
59};
60
61#[cfg(feature = "redis-client")]
62pub use sui_castore::RedisConnectionManager;
63
64#[cfg(feature = "postgres")]
65pub use sui_castore::SqlxPgCacheConn;
66
67#[cfg(test)]
68mod tests {
69 use super::*;
70
71 #[test]
72 fn cache_error_is_store_error_display() {
73 let e = CacheError::PathNotFound("/nix/store/abc".to_string());
74 assert!(format!("{e}").contains("/nix/store/abc"));
75 }
76
77 #[test]
78 fn cache_error_io_display() {
79 let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "missing");
80 let e = CacheError::Io(io_err);
81 assert!(format!("{e}").contains("missing"));
82 }
83
84 #[test]
85 fn cache_error_signing_display() {
86 let e = CacheError::Signing("bad key".to_string());
87 assert!(format!("{e}").contains("bad key"));
88 }
89
90 #[test]
91 fn cache_error_not_implemented_display() {
92 let e = CacheError::NotImplemented("S3");
93 assert!(format!("{e}").contains("S3"));
94 }
95
96 #[test]
97 fn cache_error_narinfo_display() {
98 let e = CacheError::NarInfo("parse failed".to_string());
99 assert!(format!("{e}").contains("parse failed"));
100 }
101}