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 gc::GcResult;
41pub use push::PushResult;
42pub use server::{build_router, serve, AppState};
43pub use signing::{verify_narinfo_signature, CacheSigner};
44
45pub use sui_castore::{
47 build_backend, LocalStorage, PgCacheConn, PgStorageBackend, PgTable, RedisBackend, RedisConn,
48 S3Storage, StorageBackend, StorageIndex, TieredBackend, TieredTier, WritePolicy,
49 TIERED_BACKEND_TIER,
50};
51
52#[cfg(feature = "redis-client")]
53pub use sui_castore::RedisConnectionManager;
54
55#[cfg(feature = "postgres")]
56pub use sui_castore::SqlxPgCacheConn;
57
58#[cfg(test)]
59mod tests {
60 use super::*;
61
62 #[test]
63 fn cache_error_is_store_error_display() {
64 let e = CacheError::PathNotFound("/nix/store/abc".to_string());
65 assert!(format!("{e}").contains("/nix/store/abc"));
66 }
67
68 #[test]
69 fn cache_error_io_display() {
70 let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "missing");
71 let e = CacheError::Io(io_err);
72 assert!(format!("{e}").contains("missing"));
73 }
74
75 #[test]
76 fn cache_error_signing_display() {
77 let e = CacheError::Signing("bad key".to_string());
78 assert!(format!("{e}").contains("bad key"));
79 }
80
81 #[test]
82 fn cache_error_not_implemented_display() {
83 let e = CacheError::NotImplemented("S3");
84 assert!(format!("{e}").contains("S3"));
85 }
86
87 #[test]
88 fn cache_error_narinfo_display() {
89 let e = CacheError::NarInfo("parse failed".to_string());
90 assert!(format!("{e}").contains("parse failed"));
91 }
92}