Packages: name the download counter's key
1 file+3−10/1 viewed
| 67 | 67 | /// where it is counted too): written at most every few seconds, so a | |
| 68 | 68 | /// busy image costs one write, not one a pull. What an isolate holds | |
| 69 | 69 | /// when it goes away is lost: the count is approximate. | |
| 70 | − | static DOWNLOADS: RefCell<(HashMap<(String, Option<String>), u64>, u64)> = RefCell::new((HashMap::new(), 0)); | |
| 70 | + | static DOWNLOADS: RefCell<(HashMap<DownloadKey, u64>, u64)> = RefCell::new((HashMap::new(), 0)); | |
| 71 | 71 | } | |
| 72 | 72 | const DOWNLOADS_FLUSH_MS: u64 = 10_000; | |
| 73 | + | /// A package's id, and a version's when the download counts for it too. | |
| 74 | + | type DownloadKey = (String, Option<String>); | |
| 73 | 75 | ||
| 74 | 76 | thread_local! { | |
| 75 | 77 | /// What billing allows each workspace, as asked last, and when. |