| 113 | pub(crate) use cache::LruCache; |
| 114 | |
| 115 | pub struct ChangeStore { |
| 116 | /// Path to the changes directory (`.atomic/changes/`) |
| 117 | pub(crate) changes_dir: PathBuf, |
| 118 | |
| 119 | /// LRU cache of recently accessed changes. |
| 120 | /// |
| 121 | /// We use `RwLock` for thread-safe interior mutability, allowing |
| 122 | /// concurrent read access while ensuring exclusive write access. |
| 123 | pub(crate) cache: RwLock<LruCache<Hash, Change>>, |
| 124 | |
| 125 | /// Parsed, hash-verified changes keyed by hash. Change files are |
| 126 | /// content-addressed and write-once, so a verified parse is immutable |
| 127 | /// for this handle's lifetime; re-parsing an 11 MB baseline per rendered |
| 128 | /// file is the dominant cost of span rendering. |
| 129 | pub(crate) verified_cache: RwLock<LruCache<Hash, VerifiedChange>>, |
| 130 | |
| 131 | /// Content spans held without their change files — a remote sandbox's |
| 132 | /// cache has the bytes of the vertices it was sent, never whole changes. |
| 133 | /// Consulted before the change files. |
| 134 | pub(crate) spans: RwLock<SpanOverlay>, |
| 135 | } |
| 136 | |
| 137 | /// Content bytes by `(change, start)`, each covering `start..end`. |
| 138 | #[derive(Debug, Default)] |
no outgoing calls
no test coverage detected