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::CacheConfig;
35
36pub use sui_castore::BackendConfig;
39
40pub use sui_castore::{expand_env_vars, ExpandEnvError};
44
45pub use gc::GcResult;
46pub use push::PushResult;
47pub use server::{build_router, serve, AppState};
48pub use signing::{verify_narinfo_signature, CacheSigner};
49
50pub use sui_castore::{
52 advertised_nar_url, advertised_url_line, build_backend, bytes_stream, collect_nar,
53 empty_stream, file_stream, is_addressable_nar_path, referrer_of, spool_or_buffer,
54 whole_value_stream, BytesNarSource, FileNarSource, LocalStorage, MemNarRefIndex, NarRefIndex,
55 NarRefKey, NarRefScan, NarResidency, NarSource, NarStream, PgCacheConn, PgStorageBackend,
56 PgTable, RedisBackend, RedisConn, S3Storage, SpooledNarSource, StorageBackend, StorageIndex,
57 TieredBackend, TieredTier, WritePolicy, DEFAULT_INGEST_MEMORY_CAP, NAR_CHUNK_BYTES,
58 NAR_REF_PREFIX, TIERED_BACKEND_TIER,
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}