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, is_servable_narinfo, referrer_of,
54 spool_or_buffer,
55 whole_value_stream, BytesNarSource, FileNarSource, LocalStorage, MemNarRefIndex, NarRefIndex,
56 NarRefKey, NarRefScan, NarResidency, NarSource, NarStream, PgCacheConn, PgStorageBackend,
57 PgTable, RedisBackend, RedisConn, S3Storage, SpooledNarSource, StorageBackend, StorageIndex,
58 TieredBackend, TieredTier, WritePolicy, DEFAULT_INGEST_MEMORY_CAP, NAR_CHUNK_BYTES,
59 NAR_REF_PREFIX, TIERED_BACKEND_TIER,
60};
61
62#[cfg(feature = "redis-client")]
63pub use sui_castore::RedisConnectionManager;
64
65#[cfg(feature = "postgres")]
66pub use sui_castore::SqlxPgCacheConn;
67
68#[cfg(test)]
69mod tests {
70 use super::*;
71
72 #[test]
73 fn cache_error_is_store_error_display() {
74 let e = CacheError::PathNotFound("/nix/store/abc".to_string());
75 assert!(format!("{e}").contains("/nix/store/abc"));
76 }
77
78 #[test]
79 fn cache_error_io_display() {
80 let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "missing");
81 let e = CacheError::Io(io_err);
82 assert!(format!("{e}").contains("missing"));
83 }
84
85 #[test]
86 fn cache_error_signing_display() {
87 let e = CacheError::Signing("bad key".to_string());
88 assert!(format!("{e}").contains("bad key"));
89 }
90
91 #[test]
92 fn cache_error_not_implemented_display() {
93 let e = CacheError::NotImplemented("S3");
94 assert!(format!("{e}").contains("S3"));
95 }
96
97 #[test]
98 fn cache_error_narinfo_display() {
99 let e = CacheError::NarInfo("parse failed".to_string());
100 assert!(format!("{e}").contains("parse failed"));
101 }
102}