Expand description
§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 snapshotsSnapshot- Immutable collection of resources for a nodeWatch- 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 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);Structs§
- Cache
Stats - Statistics for cache operations.
- Sharded
Cache - A high-performance sharded cache using DashMap.
- Snapshot
- An immutable snapshot of xDS resources for a node.
- Snapshot
Builder - Builder for creating snapshots.
- Snapshot
Resources - Resources for a specific type within a snapshot.
- Watch
- A watch subscription for receiving snapshot updates.
- WatchId
- Unique identifier for a watch subscription.
- Watch
Manager - Manager for watch subscriptions.
Traits§
- Cache
- Trait for xDS snapshot caches.