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