| 61 | } |
| 62 | |
| 63 | pub enum CacheDecision { |
| 64 | // We can't cache this, stream it from a remote. |
| 65 | Stream(Url), |
| 66 | // We have this item, and can send from our cache. |
| 67 | FoundObj(CacheObj<PathBuf, Status>), |
| 68 | // We don't have this item but we want it, so please dl it to this location |
| 69 | // then notify this cache. |
| 70 | MissObj { |
| 71 | fetch_url: Url, |
| 72 | cache_key: PathBuf, |
| 73 | tmp_file: NamedTempFile, |
| 74 | submit_tx: Sender<CacheMeta>, |
| 75 | cls: Classification, |
| 76 | prefetch_items: Option<Vec<PrefetchItem>>, |
| 77 | }, |
| 78 | // Refresh - we can also prefetch some paths in the background. |
| 79 | Refresh { |
| 80 | fetch_url: Url, |
| 81 | cache_key: PathBuf, |
| 82 | tmp_file: NamedTempFile, |
| 83 | submit_tx: Sender<CacheMeta>, |
| 84 | meta: CacheObj<PathBuf, Status>, |
| 85 | prefetch_items: Option<Vec<PrefetchItem>>, |
| 86 | }, |
| 87 | // We found it, but we also want to refresh in the background. |
| 88 | AsyncRefresh { |
| 89 | fetch_url: Url, |
| 90 | _cache_key: PathBuf, |
| 91 | tmp_file: NamedTempFile, |
| 92 | submit_tx: Sender<CacheMeta>, |
| 93 | meta: CacheObj<PathBuf, Status>, |
| 94 | prefetch_items: Option<Vec<PrefetchItem>>, |
| 95 | }, |
| 96 | NotFound, |
| 97 | // Can't proceed, something is wrong. |
| 98 | Invalid, |
| 99 | } |
| 100 | |
| 101 | #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] |
| 102 | pub enum Classification { |
nothing calls this directly
no outgoing calls
no test coverage detected