-
-
Notifications
You must be signed in to change notification settings - Fork 271
feat: Cache Steam save file hashes between syncs #1227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
utkarshdalal
merged 10 commits into
utkarshdalal:master
from
kiequoo:steam-save-hash-cache
May 17, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9711e87
Cache Steam save file hashes between syncs
kiequoo 521a53b
Address code review comments on steam-save-hash-cache
kiequoo fc8b4e4
Seed Steam save hash cache after downloads
kiequoo be44649
Fix runBlocking in hash cache lookups and hoist DAO reference
kiequoo 2cb8495
Verify download size before seeding hash cache
kiequoo e1d85a2
Add cache-seeding assertions to firstBoot_multipleCloudFiles_download…
kiequoo a50af79
Clear hash cache for DLC app IDs when deleting an app
kiequoo 2efd32f
fix: repair SteamAutoCloud build after rebase
kiequoo 20fe228
refactor: inject Steam file hash cache dao
kiequoo 9ed4d59
chore: add Room schema export for database v21
kiequoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1,310 changes: 1,310 additions & 0 deletions
1,310
app/schemas/app.gamenative.db.PluviaDatabase/21.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/app/gamenative/data/SteamFileHashCache.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package app.gamenative.data | ||
|
|
||
| import androidx.room.Entity | ||
|
|
||
| @Entity( | ||
| tableName = "steam_file_hash_cache", | ||
| primaryKeys = ["appId", "absPath"], | ||
| ) | ||
| data class SteamFileHashCache( | ||
| val appId: Int, | ||
| val absPath: String, | ||
| val sizeBytes: Long, | ||
| val mtimeMillis: Long, | ||
| val sha: ByteArray, | ||
| ) { | ||
| override fun equals(other: Any?): Boolean { | ||
| if (this === other) return true | ||
| if (other !is SteamFileHashCache) return false | ||
| return appId == other.appId && absPath == other.absPath && | ||
| sizeBytes == other.sizeBytes && mtimeMillis == other.mtimeMillis && | ||
| sha.contentEquals(other.sha) | ||
| } | ||
|
|
||
| override fun hashCode(): Int { | ||
| var result = appId | ||
| result = 31 * result + absPath.hashCode() | ||
| result = 31 * result + sizeBytes.hashCode() | ||
| result = 31 * result + mtimeMillis.hashCode() | ||
| result = 31 * result + sha.contentHashCode() | ||
| return result | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/src/main/java/app/gamenative/db/dao/SteamFileHashCacheDao.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package app.gamenative.db.dao | ||
|
|
||
| import androidx.room.Dao | ||
| import androidx.room.Insert | ||
| import androidx.room.OnConflictStrategy | ||
| import androidx.room.Query | ||
| import app.gamenative.data.SteamFileHashCache | ||
|
|
||
| @Dao | ||
| interface SteamFileHashCacheDao { | ||
| @Insert(onConflict = OnConflictStrategy.REPLACE) | ||
| suspend fun insert(entry: SteamFileHashCache) | ||
|
|
||
| @Query("SELECT * FROM steam_file_hash_cache WHERE appId = :appId AND absPath = :absPath") | ||
| suspend fun getByAppIdAndPath(appId: Int, absPath: String): SteamFileHashCache? | ||
|
|
||
| @Query("DELETE FROM steam_file_hash_cache WHERE appId = :appId") | ||
| suspend fun deleteByAppId(appId: Int) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log cache stats once per sync, not once per scan.
getLocalUserFilesAsPrefixMap()runs more than once in some sync paths, whilehashCacheHits/hashCacheMissesare shared across the whole sync. Logging here emits partial totals on the first scan and cumulative totals on later rescans, so the advertised per-sync metric is misleading.🤖 Prompt for AI Agents