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
DashMapfor lock-free concurrent access - All
DashMapreferences are dropped before any.awaitto prevent deadlocks - Snapshots are immutable and atomically replaced
- Watch notifications are async and non-blocking
Example
use ;
use NodeHash;
// Create a cache
let cache = new;
// Build a snapshot
let snapshot = builder
.version
.build;
// Set snapshot for a node (sync; watch notifications are async internally)
cache.set_snapshot;