Buckets:
| import type { DisposeCheck, EvictPlan } from "./types" | |
| export function pickDirectoriesToEvict(input: EvictPlan) { | |
| const overflow = Math.max(0, input.stores.length - input.max) | |
| let pendingOverflow = overflow | |
| const sorted = input.stores | |
| .filter((dir) => !input.pins.has(dir)) | |
| .slice() | |
| .sort((a, b) => (input.state.get(a)?.lastAccessAt ?? 0) - (input.state.get(b)?.lastAccessAt ?? 0)) | |
| const output: string[] = [] | |
| for (const dir of sorted) { | |
| const last = input.state.get(dir)?.lastAccessAt ?? 0 | |
| const idle = input.now - last >= input.ttl | |
| if (!idle && pendingOverflow <= 0) continue | |
| output.push(dir) | |
| if (pendingOverflow > 0) pendingOverflow -= 1 | |
| } | |
| return output | |
| } | |
| export function canDisposeDirectory(input: DisposeCheck) { | |
| if (!input.directory) return false | |
| if (!input.hasStore) return false | |
| if (input.pinned) return false | |
| if (input.booting) return false | |
| if (input.loadingSessions) return false | |
| return true | |
| } | |
Xet Storage Details
- Size:
- 964 Bytes
- Xet hash:
- 7511ee26e7fa8beaa6d0d8ad62299a234e1046d8b02419d2c2faddd7360f4f90
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.