Expand description
Reconstruction-cache contracts and adapters for Shardline.
Reconstruction responses can be expensive to compute from large metadata indexes. This crate defines a small async cache boundary keyed by file, content hash, and optional repository scope. The in-memory adapter is useful for single-process deployments; the Redis adapter lets multiple server replicas share cached reconstruction payloads.
§Example
use shardline_cache::ReconstructionCacheKey;
use shardline_protocol::{RepositoryProvider, RepositoryScope};
let scope =
RepositoryScope::new(RepositoryProvider::GitHub, "acme", "assets", Some("main"))?;
let latest = ReconstructionCacheKey::latest("file-123", Some(&scope));
let immutable = ReconstructionCacheKey::version("file-123", "content-456", Some(&scope));
assert_eq!(latest.content_hash(), None);
assert_eq!(immutable.content_hash(), Some("content-456"));
assert_eq!(latest.repository_scope().unwrap().provider(), "github");Structs§
- Disabled
Reconstruction Cache - No-op reconstruction cache adapter.
- Memory
Reconstruction Cache - Bounded in-memory reconstruction cache adapter.
- Reconstruction
Cache Key - Stable cache key for one file reconstruction response.
- Redis
Reconstruction Cache - Redis-backed reconstruction cache adapter.
- Repository
Scope Cache Key - Repository scope material embedded into a cache key.
Enums§
- Reconstruction
Cache Error - Reconstruction cache adapter failure.
Traits§
- Async
Reconstruction Cache - Asynchronous reconstruction-cache adapter contract.
Type Aliases§
- Reconstruction
Cache Future - Boxed asynchronous reconstruction-cache operation.