You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a responsive caching API for instances or global states (user home)
Goals
Support instance (<gameDir>/.cleanroom/cache) and global (~/.cleanroom/cache) locations, can be changed with system property overrides
Default to the .cleanroom/cache directory and never allow backtracking out of it. Only the root itself or nested paths are accepted, and symlinks are forbidden
Hashing. Caller-supplied SHA-256 values are strictly verified and unknown values are pinned on first use and verified on later access
Ingest via:
Web
ClassLoader resources
Path/File
From String/byte[]/ByteBuffer
Use NIO/NIO2 throughout
Support ATOMIC_MOVE
Support offline use, a cold miss under offline conditions throws a typed exception instead of an empty file
Provide a fluent builder API with sync and async terminals, safe for concurrent use
Non Goals
Download API
A general-purpose HTTP client
Quota management or background eviction
An in-memory object cache
Guarantees beyond SHA-256's standard collision resistance. The hash is recorded per entry so the algorithm can be versioned later.
Motivation
Every downloaded or generated artifact in the loader currently has the same pattern of fetching once, reuse across restarts, survive offline, never corrupt, never write outside its directory.
Without a shared API each call site re-implements URL.openStream(), Files.copy() etc. Which may inherit bugs such as
Partial files after interruption
Silent corruption on reads
Path traversal from untrusted filenames
A single cache with staged copy, locked verification and recovery gives bootstrapped files, downloads, generated files consistency.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
Add a responsive caching API for instances or global states (user home)
Goals
<gameDir>/.cleanroom/cache) and global (~/.cleanroom/cache) locations, can be changed with system property overrides.cleanroom/cachedirectory and never allow backtracking out of it. Only the root itself or nested paths are accepted, and symlinks are forbiddenPath/FileString/byte[]/ByteBufferATOMIC_MOVENon Goals
Motivation
Every downloaded or generated artifact in the loader currently has the same pattern of fetching once, reuse across restarts, survive offline, never corrupt, never write outside its directory.
Without a shared API each call site re-implements
URL.openStream(),Files.copy()etc. Which may inherit bugs such asA single cache with staged copy, locked verification and recovery gives bootstrapped files, downloads, generated files consistency.
Description
Roots
Overrides system properties:
cleanroom.cache.root.instance,cleanroom.cache.root.globalConfinement
All paths when being resolved, rejects:
Escaping
..throws an exception; interiora/../bcollapses harmlessly.Every existing root and entry component is inspected with
no-followattributes and any symbolic links are rejected.Model
Web fetches use JDK
HttpClient(redirects, 10s/30s timeouts) with conditional GET.304appends refreshed URL metadata200applies the selected content policy5xxremains an HTTP errorrevalidateIf(Duration): returns warm entries until the duration expires, default to refresh in the background.noStale(): disables time-based refreshversion(String): gives versioning to each cache entry, to be refreshed if the version is greater.Concurrency
Accepted on both saving and getting (by default?)
Hashing (TBD)
<hash>.<hash_algorithm>Dependencies
HttpClient, NIO2,MessageDigestSHA-256. No new external dependenciesReferences
No response
Guidelines
All reactions