1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! # xds-cache
//!
//! High-performance snapshot cache for xDS resources.
//!
//! This crate provides the caching layer for xDS control plane implementations:
//!
//! - [`ShardedCache`] - DashMap-based concurrent cache for snapshots
//! - [`Snapshot`] - Immutable collection of resources for a node
//! - [`Watch`] - Subscription system for cache updates
//!
//! ## Key Design Decisions
//!
//! - Uses `DashMap` for lock-free concurrent access
//! - All `DashMap` references are dropped before any `.await` to prevent deadlocks
//! - Snapshots are immutable and atomically replaced
//! - Watch notifications are async and non-blocking
//!
//! ## Example
//!
//! ```rust
//! use xds_cache::{Cache, ShardedCache, Snapshot};
//! use xds_core::NodeHash;
//!
//! // Create a cache
//! let cache = ShardedCache::new();
//!
//! // Build a snapshot
//! let snapshot = Snapshot::builder()
//! .version("v1")
//! .build();
//!
//! // Set snapshot for a node (sync; watch notifications are async internally)
//! cache.set_snapshot(NodeHash::from_id("node-1"), snapshot);
//! ```
// Tests are allowed to use .unwrap() / .expect() / panic! freely; the
// production-only warnings still apply.
pub use ;
pub use ;
pub use CacheStats;
pub use ;